summaryrefslogtreecommitdiffstats
path: root/app/notification.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-10-30 13:15:01 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-10-30 08:15:01 -0400
commit63df41b91110bac06baffef87fe0c1952b47ac93 (patch)
tree78b76635c349c3472a19a41b5fdf8333cda5879a /app/notification.go
parentbbe971cc4522dfa567d7dceafcf30a7afd5c35be (diff)
downloadchat-63df41b91110bac06baffef87fe0c1952b47ac93.tar.gz
chat-63df41b91110bac06baffef87fe0c1952b47ac93.tar.bz2
chat-63df41b91110bac06baffef87fe0c1952b47ac93.zip
fix push notification when user status is in DND (#7731)
Diffstat (limited to 'app/notification.go')
-rw-r--r--app/notification.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/notification.go b/app/notification.go
index 1f9bcfee0..01f76ab33 100644
--- a/app/notification.go
+++ b/app/notification.go
@@ -988,14 +988,17 @@ func DoesNotifyPropsAllowPushNotification(user *model.User, channelNotifyProps m
}
func DoesStatusAllowPushNotification(userNotifyProps model.StringMap, status *model.Status, channelId string) bool {
+ // If User status is DND return false right away
+ if status.Status == model.STATUS_DND {
+ return false
+ }
+
if pushStatus, ok := userNotifyProps["push_status"]; (pushStatus == model.STATUS_ONLINE || !ok) && (status.ActiveChannel != channelId || model.GetMillis()-status.LastActivityAt > model.STATUS_CHANNEL_TIMEOUT) {
return true
} else if pushStatus == model.STATUS_AWAY && (status.Status == model.STATUS_AWAY || status.Status == model.STATUS_OFFLINE) {
return true
} else if pushStatus == model.STATUS_OFFLINE && status.Status == model.STATUS_OFFLINE {
return true
- } else if status.Status == model.STATUS_DND {
- return false
}
return false