diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-09-15 08:37:29 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-09-15 08:37:29 -0400 |
commit | 2a6cd44f23e1b3207debaa73801f0c63a2c81126 (patch) | |
tree | 5dbb9ce895449036546df12d7b083751750c4085 /app/notification.go | |
parent | 2be5577b88e5ff85a98b0a2b3e3a43b90cc99c6d (diff) | |
download | chat-2a6cd44f23e1b3207debaa73801f0c63a2c81126.tar.gz chat-2a6cd44f23e1b3207debaa73801f0c63a2c81126.tar.bz2 chat-2a6cd44f23e1b3207debaa73801f0c63a2c81126.zip |
PLT-7509 Stopped processing special mentions for change of header/purpose messages (#7410)
Diffstat (limited to 'app/notification.go')
-rw-r--r-- | app/notification.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/app/notification.go b/app/notification.go index b0a6a02e2..511960f84 100644 --- a/app/notification.go +++ b/app/notification.go @@ -71,7 +71,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod mentionedUserIds[post.UserId] = true } } else { - keywords := GetMentionKeywordsInChannel(profileMap) + keywords := GetMentionKeywordsInChannel(profileMap, post.Type != model.POST_HEADER_CHANGE && post.Type != model.POST_PURPOSE_CHANGE) var potentialOtherMentions []string mentionedUserIds, potentialOtherMentions, hereNotification, channelNotification, allNotification = GetExplicitMentions(post.Message, keywords) @@ -873,7 +873,7 @@ func removeCodeFromMessage(message string) string { // Given a map of user IDs to profiles, returns a list of mention // keywords for all users in the channel. -func GetMentionKeywordsInChannel(profiles map[string]*model.User) map[string][]string { +func GetMentionKeywordsInChannel(profiles map[string]*model.User, lookForSpecialMentions bool) map[string][]string { keywords := make(map[string][]string) for id, profile := range profiles { @@ -896,13 +896,15 @@ func GetMentionKeywordsInChannel(profiles map[string]*model.User) map[string][]s } // Add @channel and @all to keywords if user has them turned on - if int64(len(profiles)) < *utils.Cfg.TeamSettings.MaxNotificationsPerChannel && profile.NotifyProps["channel"] == "true" { - keywords["@channel"] = append(keywords["@channel"], profile.Id) - keywords["@all"] = append(keywords["@all"], profile.Id) - - status := GetStatusFromCache(profile.Id) - if status != nil && status.Status == model.STATUS_ONLINE { - keywords["@here"] = append(keywords["@here"], profile.Id) + if lookForSpecialMentions { + if int64(len(profiles)) < *utils.Cfg.TeamSettings.MaxNotificationsPerChannel && profile.NotifyProps["channel"] == "true" { + keywords["@channel"] = append(keywords["@channel"], profile.Id) + keywords["@all"] = append(keywords["@all"], profile.Id) + + status := GetStatusFromCache(profile.Id) + if status != nil && status.Status == model.STATUS_ONLINE { + keywords["@here"] = append(keywords["@here"], profile.Id) + } } } } |