diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-09-02 12:50:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-02 12:50:15 -0400 |
commit | f32eb525f3fa0828a23f589d765c267e3b2aea86 (patch) | |
tree | d4b76aecf89143029af080b3e1b4d87398e0adc5 /api/post.go | |
parent | eb0111f6bbe2b0bf160a674dfe1b4d089f905cb9 (diff) | |
download | chat-f32eb525f3fa0828a23f589d765c267e3b2aea86.tar.gz chat-f32eb525f3fa0828a23f589d765c267e3b2aea86.tar.bz2 chat-f32eb525f3fa0828a23f589d765c267e3b2aea86.zip |
Do not send push notifications for channels being actively viewed (#3931)
Diffstat (limited to 'api/post.go')
-rw-r--r-- | api/post.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/api/post.go b/api/post.go index 55e63cd23..d62b85059 100644 --- a/api/post.go +++ b/api/post.go @@ -682,7 +682,7 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel * var status *model.Status var err *model.AppError if status, err = GetStatus(id); err != nil { - status = &model.Status{id, model.STATUS_OFFLINE, false, 0} + status = &model.Status{id, model.STATUS_OFFLINE, false, 0, ""} } if userAllowsEmails && status.Status != model.STATUS_ONLINE { @@ -739,10 +739,10 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel * var status *model.Status var err *model.AppError if status, err = GetStatus(id); err != nil { - status = &model.Status{id, model.STATUS_OFFLINE, false, 0} + status = &model.Status{id, model.STATUS_OFFLINE, false, 0, ""} } - if profileMap[id].StatusAllowsPushNotification(status) { + if DoesStatusAllowPushNotification(profileMap[id], status, post.ChannelId) { sendPushNotification(post, profileMap[id], channel, senderName, true) } } @@ -752,10 +752,10 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel * var status *model.Status var err *model.AppError if status, err = GetStatus(id); err != nil { - status = &model.Status{id, model.STATUS_OFFLINE, false, 0} + status = &model.Status{id, model.STATUS_OFFLINE, false, 0, ""} } - if profileMap[id].StatusAllowsPushNotification(status) { + if DoesStatusAllowPushNotification(profileMap[id], status, post.ChannelId) { sendPushNotification(post, profileMap[id], channel, senderName, false) } } @@ -945,7 +945,6 @@ func sendPushNotification(post *model.Post, user *model.User, channel *model.Cha func clearPushNotification(userId string, channelId string) { session := getMobileAppSession(userId) - if session == nil { return } |