mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
chore: Strip unnecessary data from push payload (#2924)
This commit is contained in:
@@ -60,6 +60,16 @@ class Notification < ApplicationRecord
|
||||
}
|
||||
end
|
||||
|
||||
def fcm_push_data
|
||||
{
|
||||
id: id,
|
||||
notification_type: notification_type,
|
||||
primary_actor_id: primary_actor_id,
|
||||
primary_actor_type: primary_actor_type,
|
||||
primary_actor: primary_actor.push_event_data.slice(:conversation_id)
|
||||
}
|
||||
end
|
||||
|
||||
# TODO: move to a data presenter
|
||||
def push_message_title
|
||||
case notification_type
|
||||
|
||||
@@ -94,9 +94,10 @@ class Notification::PushNotificationService
|
||||
{
|
||||
notification: {
|
||||
title: notification.notification_type.titleize,
|
||||
body: notification.push_message_title
|
||||
body: notification.push_message_title,
|
||||
sound: 'default'
|
||||
},
|
||||
data: { notification: notification.push_event_data.to_json },
|
||||
data: { notification: notification.fcm_push_data.to_json },
|
||||
collapse_key: "chatwoot_#{notification.primary_actor_type.downcase}_#{notification.primary_actor_id}"
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user