diff options
author | David Meza <dmeza@users.noreply.github.com> | 2017-05-30 11:02:44 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-05-30 12:02:44 -0400 |
commit | eab6f7459478d23968466766cbe49185d405a056 (patch) | |
tree | 3323cfd3c2592177fa9ce6c856cc12283a4e9cf3 /app | |
parent | 23ca4fe69cb4baf0c38666b917eb8307949d8b5b (diff) | |
download | chat-eab6f7459478d23968466766cbe49185d405a056.tar.gz chat-eab6f7459478d23968466766cbe49185d405a056.tar.bz2 chat-eab6f7459478d23968466766cbe49185d405a056.zip |
PLT-6485 Add ability to disable `@here` notifications (#6372)
Diffstat (limited to 'app')
-rw-r--r-- | app/notification.go | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/app/notification.go b/app/notification.go index 4efdd3d6d..49576d1f0 100644 --- a/app/notification.go +++ b/app/notification.go @@ -222,23 +222,6 @@ func SendNotifications(post *model.Post, team *model.Team, channel *model.Channe ) } - if hereNotification { - statuses := GetAllStatuses() - for _, status := range statuses { - if status.UserId == post.UserId { - continue - } - - _, profileFound := profileMap[status.UserId] - _, alreadyMentioned := mentionedUserIds[status.UserId] - - if status.Status == model.STATUS_ONLINE && profileFound && !alreadyMentioned { - mentionedUsersList = append(mentionedUsersList, status.UserId) - updateMentionChans = append(updateMentionChans, Srv.Store.Channel().IncrementMentionCount(post.ChannelId, status.UserId)) - } - } - } - // Make sure all mention updates are complete to prevent race // Probably better to batch these DB updates in the future // MUST be completed before push notifications send @@ -790,6 +773,11 @@ func GetMentionKeywordsInChannel(profiles map[string]*model.User) map[string][]s 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) + } } } |