* Create infrastructure to manage mentions
Two new files have been added (along with their tests); namely:
- model/at_mentions.go: utilities to parse and manage mentions; for the moment,
it just contains a regex and a couple of functions to parse possible mentions
and to post-process them, but it can be extended in the future.
- model/mention_map.go: it contains two new types (UserMentionMap and
ChannelMentionMap) that both have FromURLValues and ToURLValues. These types
can be used when adding the mentions to the payload of the plugin slash
commands.
* Extend custom commands payload with mentions
Two couples of new fields are added to the payload; namely:
- user_mentions and user_mentions_ids: two aligned arrays of the same length
containing all the different @-mentions found in the command: the i-th element
of user_mentions_ids is the user identifier of the i-th element of
user_mentions.
- channel_mentions and channel_mentions_ids: two aligned arrays of the same
length containing all the different ~-mentions found in the command: the i-th
element of channel_mentions_ids is the channel identifier of the i-th element
of channel_mentions.
* Fix shadowing of variables and redundant return
* Fix shadowing of variable
* Address review comments (HT @lieut-data)
- Improvements in mentionsToTeamMembers and mentionsToPublicChannels:
- Scope implementation details inside the functions.
- Improve goroutines synchronization by using a sync.WaitGroup.
- Retry lookup of username only if the returned error is http.StatusCode,
so we can return early if the error is more severe.
- Invert check in PossibleAtMentions to improve readability.
- Make user and channel mention keys private to the module.
- Allow the specification of an empty map of mentions in
(Channel|User)MentionsFromURLValues when both mentions keys are absent.
- Replace custom functions in tests with require.Equal on maps.
* Test functions to parse mentions from messages
* Extend plugin commands payload with mentions
* Add functions to CommandArgs to add mentions
The functions make sure that the maps are initialized before adding any value.
* Address review comments (HT @lieut-data)
- Adds a mlog.Warn to avoid burying the error when the user is not found.
- Improve readability in loop populating the mention map by moving the
initialization of the map closer to the loop and by iterating over the channel
itself, not over its length.
* File was not gofmt-ed with -s
* Close channel when all goroutines are finished
* Again, all code should be checked with gofmt -s
* Refactor code out of a goroutine
This change helps improve the readability of the code and does not affect its
overall performance. Less complexity is always better.
* Close channel and iterate over its range
Adapt mentionsToPublicChannels to have the same structure in the management
of the mentions channel as in mentionsToTeamMembers.
* Adapt mentionsToTeamMembers to new App
Commit 17523fa changed the App structure, making the *Server field
private, which is now accessed through the Srv() function.
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Mattermost is an open source, private cloud, Slack-alternative from https://mattermost.com.
It's written in Golang and React and runs as a single Linux binary with MySQL or PostgreSQL. Every month on the 16th a new compiled version is released under an MIT license.
Try out Mattermost
- Join the Mattermost Contributor's server to join community discussions about contributions, development and more
- Join the Mattermost Demo server to try out Mattermost and explore sample use cases
Deploy on Heroku
Note: Heroku preview does not include email or persistent storage
Deploy on a Cloud Platform via Bitnami
Auto-deploy Mattermost to Amazon Web Services, Azure, Google Cloud Platform, or Oracle Cloud Platform via Bitnami.
Install on Your Own Machine
- One-line Docker Preview
- Developer Machine Setup
- Production Install Guides using Linux Binary
- Production Docker Install
Native Mobile and Desktop Apps
In addition to the web interface, you can also download Mattermost clients for Android, iOS, Windows PC, Mac OSX, and Linux.
Get Security Bulletins
Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you are deploying Mattermost it is highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases.
Get Involved
- Contribute Code
- Find "Help Wanted" projects
- Join Developer Discussion on a Mattermost Server for contributors
- File Bugs
- Share Feature Ideas
- Get Troubleshooting Help
- Help translate Mattermost
Learn More
- API Options - webhooks, slash commands, drivers and web service
- See who's using Mattermost
- Browse over 700 Mattermost integrations
Get the Latest News
- Twitter - Follow Mattermost
- Blog - Get the latest updates from the Mattermost blog.
- Email - Subscribe to our newsletter (1 or 2 per month)
- Mattermost - Join the ~contributors channel on the Mattermost Community Server.
- IRC - Join the #matterbridge channel on Freenode (thanks to matterircd).
Any other questions, mail us at info@mattermost.com. We’d love to meet you!





