From 4921fda79ff12b5e61cf66662932ab254535e16c Mon Sep 17 00:00:00 2001 From: Martin Kraft Date: Thu, 19 Apr 2018 06:28:04 -0400 Subject: MM-10122: Adds a mention for added-to-channel messages even when 'username mentions' are disabled. (#8648) --- app/notification.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/notification.go') 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 -- cgit v1.2.3-1-g7c22