diff options
author | Martin Kraft <mkraft@users.noreply.github.com> | 2018-04-19 06:28:04 -0400 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2018-04-19 11:28:04 +0100 |
commit | 4921fda79ff12b5e61cf66662932ab254535e16c (patch) | |
tree | 0fd1d0e2de393ef9cf35eb6a575b4959ea6c3fb3 /app/notification.go | |
parent | 2b83f8c48f1bd84c06fe6dacc41d3013cbc3e1d0 (diff) | |
download | chat-4921fda79ff12b5e61cf66662932ab254535e16c.tar.gz chat-4921fda79ff12b5e61cf66662932ab254535e16c.tar.bz2 chat-4921fda79ff12b5e61cf66662932ab254535e16c.zip |
MM-10122: Adds a mention for added-to-channel messages even when 'username mentions' are disabled. (#8648)
Diffstat (limited to 'app/notification.go')
-rw-r--r-- | app/notification.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/notification.go b/app/notification.go index e4ee041af..d69bb4e2e 100644 --- a/app/notification.go +++ b/app/notification.go @@ -89,6 +89,17 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod keywords := a.GetMentionKeywordsInChannel(profileMap, post.Type != model.POST_HEADER_CHANGE && post.Type != model.POST_PURPOSE_CHANGE) m := GetExplicitMentions(post.Message, keywords) + + // Add an implicit mention when a user is added to a channel + // even if the user has set 'username mentions' to false in account settings. + if post.Type == model.POST_ADD_TO_CHANNEL { + val := post.Props[model.POST_PROPS_ADDED_USER_ID] + if val != nil { + uid := val.(string) + m.MentionedUserIds[uid] = true + } + } + mentionedUserIds, hereNotification, channelNotification, allNotification = m.MentionedUserIds, m.HereMentioned, m.ChannelMentioned, m.AllMentioned // get users that have comment thread mentions enabled |