Skip to content

Commit 7e3a274

Browse files
authored
MM-36687 Fix CRT Notifications (#85)
* Added ios grouping and is_crt_enabled * rootId is added to base push notification * is_crt_enabled is passed as boolean instead of string * Add rootId only when available
1 parent 1016c30 commit 7e3a274

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

server/android_notification_server.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ func (me *AndroidNotificationServer) Initialize() bool {
3838
func (me *AndroidNotificationServer) SendNotification(msg *PushNotification) PushResponse {
3939
pushType := msg.Type
4040
data := map[string]interface{}{
41-
"ack_id": msg.AckID,
42-
"type": pushType,
43-
"badge": msg.Badge,
44-
"version": msg.Version,
45-
"channel_id": msg.ChannelID,
41+
"ack_id": msg.AckID,
42+
"type": pushType,
43+
"badge": msg.Badge,
44+
"version": msg.Version,
45+
"channel_id": msg.ChannelID,
46+
"is_crt_enabled": msg.IsCRTEnabled,
47+
}
48+
49+
if msg.RootID != "" {
50+
data["root_id"] = msg.RootID
4651
}
4752

4853
if msg.IsIDLoaded {
@@ -58,7 +63,6 @@ func (me *AndroidNotificationServer) SendNotification(msg *PushNotification) Pus
5863
data["message"] = emoji.Sprint(msg.Message)
5964
data["channel_name"] = msg.ChannelName
6065
data["post_id"] = msg.PostID
61-
data["root_id"] = msg.RootID
6266
data["override_username"] = msg.OverrideUsername
6367
data["override_icon_url"] = msg.OverrideIconURL
6468
data["from_webhook"] = msg.FromWebhook

server/apple_notification_server.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,16 @@ func (me *AppleNotificationServer) SendNotification(msg *PushNotification) PushR
129129
data.Custom("ack_id", msg.AckID)
130130
}
131131

132+
data.Custom("is_crt_enabled", msg.IsCRTEnabled)
133+
132134
if msg.ChannelID != "" {
133135
data.Custom("channel_id", msg.ChannelID)
134-
data.ThreadID(msg.ChannelID)
136+
137+
if msg.IsCRTEnabled && msg.RootID != "" {
138+
data.ThreadID(msg.RootID)
139+
} else {
140+
data.ThreadID(msg.ChannelID)
141+
}
135142
}
136143

137144
if msg.TeamID != "" {

server/push_notification.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type PushNotification struct {
5151
OverrideIconURL string `json:"override_icon_url"`
5252
FromWebhook string `json:"from_webhook"`
5353
Version string `json:"version"`
54+
IsCRTEnabled bool `json:"is_crt_enabled"`
5455
IsIDLoaded bool `json:"is_id_loaded"`
5556
}
5657

0 commit comments

Comments
 (0)