From 63df41b91110bac06baffef87fe0c1952b47ac93 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Mon, 30 Oct 2017 13:15:01 +0100 Subject: fix push notification when user status is in DND (#7731) --- app/notification.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/notification.go') 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 -- cgit v1.2.3-1-g7c22