summaryrefslogtreecommitdiffstats
path: root/api/post.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-10 11:38:03 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-10 11:38:03 -0500
commit4101b28de58ab8c2e821cda5f8e7bc8e836d7bb8 (patch)
tree08487ad295df115bcbd07b42f85acd63ca65b986 /api/post.go
parent056be669fc99eaa23905fb79ce970ac87302bd69 (diff)
downloadchat-4101b28de58ab8c2e821cda5f8e7bc8e836d7bb8.tar.gz
chat-4101b28de58ab8c2e821cda5f8e7bc8e836d7bb8.tar.bz2
chat-4101b28de58ab8c2e821cda5f8e7bc8e836d7bb8.zip
Use status cache for checking @here notifications (#5035)
Diffstat (limited to 'api/post.go')
-rw-r--r--api/post.go25
1 files changed, 10 insertions, 15 deletions
diff --git a/api/post.go b/api/post.go
index 8d6fa0b02..45ead08e0 100644
--- a/api/post.go
+++ b/api/post.go
@@ -787,23 +787,18 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel *
}
if hereNotification {
- if result := <-Srv.Store.Status().GetOnline(); result.Err != nil {
- l4g.Warn(utils.T("api.post.notification.here.warn"), result.Err)
- return nil
- } else {
- statuses := result.Data.([]*model.Status)
- for _, status := range statuses {
- if status.UserId == post.UserId {
- continue
- }
+ statuses := GetAllStatuses()
+ for _, status := range statuses {
+ if status.UserId == post.UserId {
+ continue
+ }
- _, profileFound := profileMap[status.UserId]
- _, alreadyMentioned := mentionedUserIds[status.UserId]
+ _, 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))
- }
+ if status.Status == model.STATUS_ONLINE && profileFound && !alreadyMentioned {
+ mentionedUsersList = append(mentionedUsersList, status.UserId)
+ updateMentionChans = append(updateMentionChans, Srv.Store.Channel().IncrementMentionCount(post.ChannelId, status.UserId))
}
}
}