summaryrefslogtreecommitdiffstats
path: root/app/status.go
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2017-03-02 18:38:38 -0300
committerGitHub <noreply@github.com>2017-03-02 18:38:38 -0300
commit7de54f063cb260dfcae6c21563df3a044e2160b1 (patch)
tree7d69faf1fb5ce65af86b05490625b388732f80ce /app/status.go
parent47114a18e3d6dc2090beeb43d03f865d6436a99a (diff)
downloadchat-7de54f063cb260dfcae6c21563df3a044e2160b1.tar.gz
chat-7de54f063cb260dfcae6c21563df3a044e2160b1.tar.bz2
chat-7de54f063cb260dfcae6c21563df3a044e2160b1.zip
Fix push notifications where channel is set to all activity (#5594)
* Fix push notifications where channel is set to all activity * feedback review * moved push notification logic to DoesStatusAllowPushNotification * Have every option handled in ShouldSendPushNotification * unit tests
Diffstat (limited to 'app/status.go')
-rw-r--r--app/status.go18
1 files changed, 0 insertions, 18 deletions
diff --git a/app/status.go b/app/status.go
index bef17165f..51e7d1ed8 100644
--- a/app/status.go
+++ b/app/status.go
@@ -235,21 +235,3 @@ func GetStatus(userId string) (*model.Status, *model.AppError) {
func IsUserAway(lastActivityAt int64) bool {
return model.GetMillis()-lastActivityAt >= *utils.Cfg.TeamSettings.UserStatusAwayTimeout*1000
}
-
-func DoesStatusAllowPushNotification(user *model.User, status *model.Status, channelId string) bool {
- props := user.NotifyProps
-
- if props["push"] == "none" {
- return false
- }
-
- if pushStatus, ok := props["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
- }
-
- return false
-}