chore: Change the notification text for mention notification type (#2534)

This commit is contained in:
Muhsin Keloth
2021-06-29 14:32:57 +05:30
committed by GitHub
parent 044b6872a4
commit 8027c69c1c
5 changed files with 44 additions and 4 deletions

View File

@@ -50,11 +50,32 @@ RSpec.describe Notification do
end
it 'returns appropriate title suited for the notification type conversation_mention' do
message = create(:message, sender: create(:user))
message = create(:message, sender: create(:user), content: 'Hey [@John](mention://user/1/john), can you check this ticket?')
notification = create(:notification, notification_type: 'conversation_mention', primary_actor: message, secondary_actor: message.sender)
expect(notification.push_message_title).to eq "You have been mentioned in conversation [ID - #{message.conversation.display_id}] \
by #{message.sender.name}"
expect(notification.push_message_title).to eq "[##{message.conversation.display_id}] Hey @John, can you check this ticket?"
end
it 'returns appropriate title suited for the notification type conversation_mention having multiple mentions' do
message = create(
:message, sender:
create(:user),
content: 'Hey [@John](mention://user/1/john), [@Alisha Peter](mention://user/2/alisha) can you check this ticket?'
)
notification = create(:notification, notification_type: 'conversation_mention', primary_actor: message, secondary_actor: message.sender)
expect(notification.push_message_title).to eq "[##{message.conversation.display_id}] Hey @John, @Alisha Peter can you check this ticket?"
end
it 'returns appropriate title suited for the notification type conversation_mention if username contains white space' do
message = create(
:message, sender:
create(:user),
content: 'Hey [@John Peter](mention://user/1/john%20K) please check this?'
)
notification = create(:notification, notification_type: 'conversation_mention', primary_actor: message, secondary_actor: message.sender)
expect(notification.push_message_title).to eq "[##{message.conversation.display_id}] Hey @John Peter please check this?"
end
end
end