chore: Add display id in all conversation notifications (#3635)

- Added conversation display id in push payload for the notifications conversation_creation and conversation_assignment
This commit is contained in:
Muhsin Keloth
2021-12-21 19:59:22 +05:30
committed by GitHub
parent 307118b235
commit 262474166f
2 changed files with 20 additions and 1 deletions

View File

@@ -78,4 +78,23 @@ RSpec.describe Notification do
expect(notification.push_message_title).to eq "[##{message.conversation.display_id}] Hey @John Peter please check this?"
end
end
context 'when fcm push data' do
it 'returns correct data for primary actor conversation' do
notification = create(:notification, notification_type: 'conversation_creation')
expect(notification.fcm_push_data[:primary_actor]).to eq({
'id' => notification.primary_actor.display_id
})
end
it 'returns correct data for primary actor message' do
message = create(:message, sender: create(:user), content: Faker::Lorem.paragraphs(number: 2))
notification = create(:notification, notification_type: 'assigned_conversation_new_message', primary_actor: message)
expect(notification.fcm_push_data[:primary_actor]).to eq({
'id' => notification.primary_actor.id,
'conversation_id' => notification.primary_actor.conversation.display_id
})
end
end
end