Do not send push notifications for channels being actively viewed (#3931)

Этот коммит содержится в:
Joram Wilander
2016-09-02 12:50:15 -04:00
коммит произвёл GitHub
родитель eb0111f6bb
Коммит f32eb525f3
20 изменённых файлов: 213 добавлений и 47 удалений

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

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