summaryrefslogtreecommitdiffstats
path: root/app/notification.go
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2017-08-28 11:54:23 -0300
committerGitHub <noreply@github.com>2017-08-28 11:54:23 -0300
commit871b7eaa66b84fc260ef5406d63671e1869c993f (patch)
tree9046bd3262f5e341d4b1bfd79ea7fcc31f4651c0 /app/notification.go
parent1709b94227ed33e789f1be00d26ebbb972ce86b7 (diff)
downloadchat-871b7eaa66b84fc260ef5406d63671e1869c993f.tar.gz
chat-871b7eaa66b84fc260ef5406d63671e1869c993f.tar.bz2
chat-871b7eaa66b84fc260ef5406d63671e1869c993f.zip
Include post_id and root_id to handle actions from the PN (#7286)
Diffstat (limited to 'app/notification.go')
-rw-r--r--app/notification.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/notification.go b/app/notification.go
index 1d3416794..258606ad4 100644
--- a/app/notification.go
+++ b/app/notification.go
@@ -574,6 +574,8 @@ func sendPushNotification(post *model.Post, user *model.User, channel *model.Cha
msg.Type = model.PUSH_TYPE_MESSAGE
msg.TeamId = channel.TeamId
msg.ChannelId = channel.Id
+ msg.PostId = post.Id
+ msg.RootId = post.RootId
msg.ChannelName = channel.Name
msg.SenderId = post.UserId
@@ -590,15 +592,15 @@ func sendPushNotification(post *model.Post, user *model.User, channel *model.Cha
}
if *utils.Cfg.EmailSettings.PushNotificationContents == model.FULL_NOTIFICATION {
+ msg.Category = model.CATEGORY_CAN_REPLY
if channel.Type == model.CHANNEL_DIRECT {
- msg.Category = model.CATEGORY_DM
msg.Message = senderName + ": " + model.ClearMentionTags(post.Message)
} else {
msg.Message = senderName + userLocale("api.post.send_notifications_and_forget.push_in") + channelName + ": " + model.ClearMentionTags(post.Message)
}
} else if *utils.Cfg.EmailSettings.PushNotificationContents == model.GENERIC_NO_CHANNEL_NOTIFICATION {
if channel.Type == model.CHANNEL_DIRECT {
- msg.Category = model.CATEGORY_DM
+ msg.Category = model.CATEGORY_CAN_REPLY
msg.Message = senderName + userLocale("api.post.send_notifications_and_forget.push_message")
} else if wasMentioned || channel.Type == model.CHANNEL_GROUP {
msg.Message = senderName + userLocale("api.post.send_notifications_and_forget.push_mention_no_channel")
@@ -607,9 +609,10 @@ func sendPushNotification(post *model.Post, user *model.User, channel *model.Cha
}
} else {
if channel.Type == model.CHANNEL_DIRECT {
- msg.Category = model.CATEGORY_DM
+ msg.Category = model.CATEGORY_CAN_REPLY
msg.Message = senderName + userLocale("api.post.send_notifications_and_forget.push_message")
} else if wasMentioned || channel.Type == model.CHANNEL_GROUP {
+ msg.Category = model.CATEGORY_CAN_REPLY
msg.Message = senderName + userLocale("api.post.send_notifications_and_forget.push_mention") + channelName
} else {
msg.Message = senderName + userLocale("api.post.send_notifications_and_forget.push_non_mention") + channelName
@@ -625,7 +628,7 @@ func sendPushNotification(post *model.Post, user *model.User, channel *model.Cha
}
}
- l4g.Debug("Sending push notification for user %v with msg of '%v'", user.Id, msg.Message)
+ //l4g.Debug("Sending push notification for user %v with msg of '%v'", user.Id, msg.Message)
for _, session := range sessions {
tmpMessage := *model.PushNotificationFromJson(strings.NewReader(msg.ToJson()))