chore: Change primary actor to Conversation for all the notification types. (#8435)

This commit is contained in:
Muhsin Keloth
2023-12-06 10:43:09 +05:30
committed by GitHub
parent 17faa6c3b2
commit 76711d95ff
12 changed files with 91 additions and 74 deletions

View File

@@ -32,7 +32,8 @@ describe Messages::MentionService do
expect(NotificationBuilder).to have_received(:new).with(notification_type: 'conversation_mention',
user: first_agent,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
end
@@ -55,11 +56,13 @@ describe Messages::MentionService do
expect(NotificationBuilder).to have_received(:new).with(notification_type: 'conversation_mention',
user: second_agent,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
expect(NotificationBuilder).to have_received(:new).with(notification_type: 'conversation_mention',
user: first_agent,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
it 'add the users to the participants list' do

View File

@@ -40,21 +40,24 @@ describe Messages::NewMessageNotificationService do
expect(NotificationBuilder).to have_received(:new).with(notification_type: 'participating_conversation_new_message',
user: participating_agent_2,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
it 'creates notifications for assignee' do
expect(NotificationBuilder).to have_received(:new).with(notification_type: 'assigned_conversation_new_message',
user: assignee,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
it 'will not create notifications for the user who created the message' do
expect(NotificationBuilder).not_to have_received(:new).with(notification_type: 'participating_conversation_new_message',
user: participating_agent_1,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
end
@@ -69,18 +72,21 @@ describe Messages::NewMessageNotificationService do
expect(NotificationBuilder).to have_received(:new).with(notification_type: 'assigned_conversation_new_message',
user: assignee,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
it 'creates notifications for all participating users' do
expect(NotificationBuilder).to have_received(:new).with(notification_type: 'participating_conversation_new_message',
user: participating_agent_1,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
expect(NotificationBuilder).to have_received(:new).with(notification_type: 'participating_conversation_new_message',
user: participating_agent_2,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
end
@@ -97,7 +103,8 @@ describe Messages::NewMessageNotificationService do
expect(NotificationBuilder).not_to have_received(:new).with(notification_type: 'assigned_conversation_new_message',
user: assignee,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
end
@@ -112,11 +119,13 @@ describe Messages::NewMessageNotificationService do
expect(NotificationBuilder).not_to have_received(:new).with(notification_type: 'participating_conversation_new_message',
user: assignee,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
expect(NotificationBuilder).not_to have_received(:new).with(notification_type: 'assigned_conversation_new_message',
user: assignee,
account: account,
primary_actor: message)
primary_actor: message.conversation,
secondary_actor: message)
end
end
end