From eab6f7459478d23968466766cbe49185d405a056 Mon Sep 17 00:00:00 2001 From: David Meza Date: Tue, 30 May 2017 11:02:44 -0500 Subject: PLT-6485 Add ability to disable `@here` notifications (#6372) --- app/notification.go | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'app/notification.go') 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) + } } } -- cgit v1.2.3-1-g7c22