feat: Add labels, status and priority in notification push_event_data (#8972)
This commit is contained in:
@@ -68,20 +68,12 @@ class Notification < ApplicationRecord
|
|||||||
|
|
||||||
}
|
}
|
||||||
if primary_actor.present?
|
if primary_actor.present?
|
||||||
payload[:primary_actor] = primary_actor_data
|
payload[:primary_actor] = primary_actor&.push_event_data
|
||||||
payload[:push_message_title] = push_message_title
|
payload[:push_message_title] = push_message_title
|
||||||
end
|
end
|
||||||
payload
|
payload
|
||||||
end
|
end
|
||||||
|
|
||||||
def primary_actor_data
|
|
||||||
{
|
|
||||||
id: primary_actor.push_event_data[:id],
|
|
||||||
meta: primary_actor.push_event_data[:meta],
|
|
||||||
inbox_id: primary_actor.push_event_data[:inbox_id]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def fcm_push_data
|
def fcm_push_data
|
||||||
{
|
{
|
||||||
id: id,
|
id: id,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ RSpec.describe 'Notifications API', type: :request do
|
|||||||
expect(response_json['data']['meta']['count']).to eq 2
|
expect(response_json['data']['meta']['count']).to eq 2
|
||||||
# notification appear in descending order
|
# notification appear in descending order
|
||||||
expect(response_json['data']['payload'].first['id']).to eq notification2.id
|
expect(response_json['data']['payload'].first['id']).to eq notification2.id
|
||||||
|
expect(response_json['data']['payload'].first['primary_actor']).not_to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user