fix: un-assign agent from conversation after removal (#5417)

Unassign agents from the conversation when they are removed from the account.

Fixes: #4555
This commit is contained in:
Shivam Chahar
2022-09-20 06:44:55 +05:30
committed by GitHub
parent 99de8f4500
commit 6b80afaf50
2 changed files with 8 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ class Agents::DestroyService
destroy_notification_setting
remove_user_from_teams
remove_user_from_inboxes
unassign_conversations
end
end
@@ -27,4 +28,8 @@ class Agents::DestroyService
setting = user.notification_settings.find_by(account_id: account.id)
setting&.destroy!
end
def unassign_conversations
user.assigned_conversations.where(account: account).find_each(&:update_assignee)
end
end