mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
feat: Assign team with teams none option (#5871)
This commit is contained in:
@@ -78,6 +78,9 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
|
||||
'action_name': :add_label,
|
||||
'action_params': %w[support priority_customer]
|
||||
},
|
||||
{
|
||||
'action_name': :remove_assigned_team
|
||||
},
|
||||
{
|
||||
'action_name': :send_message,
|
||||
'action_params': ['Welcome to the chatwoot platform.']
|
||||
@@ -379,6 +382,34 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
|
||||
expect(conversation.messages.last.sender).to eq(administrator)
|
||||
expect(conversation.messages.last.private).to be_truthy
|
||||
end
|
||||
|
||||
it 'Assign the team if team_ids are present' do
|
||||
expect(conversation.team).to be_nil
|
||||
|
||||
perform_enqueued_jobs do
|
||||
post "/api/v1/accounts/#{account.id}/macros/#{macro.id}/execute",
|
||||
params: { conversation_ids: [conversation.display_id] },
|
||||
headers: administrator.create_new_auth_token
|
||||
end
|
||||
|
||||
expect(conversation.reload.team_id).to eq(team.id)
|
||||
end
|
||||
|
||||
it 'Unassign the team' do
|
||||
macro.update!(actions: [
|
||||
{ 'action_name' => 'remove_assigned_team' }
|
||||
])
|
||||
conversation.update!(team_id: team.id)
|
||||
expect(conversation.reload.team).not_to be_nil
|
||||
|
||||
perform_enqueued_jobs do
|
||||
post "/api/v1/accounts/#{account.id}/macros/#{macro.id}/execute",
|
||||
params: { conversation_ids: [conversation.display_id] },
|
||||
headers: administrator.create_new_auth_token
|
||||
end
|
||||
|
||||
expect(conversation.reload.team_id).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user