Use status cache for checking @here notifications (#5035)

Этот коммит содержится в:
Joram Wilander
2017-01-10 11:38:03 -05:00
коммит произвёл Harrison Healey
родитель 056be669fc
Коммит 4101b28de5
3 изменённых файлов: 48 добавлений и 40 удалений

Просмотреть файл

@@ -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))
}
}
}