feat: Remove labels in macro (#5875)
This commit is contained in:
@@ -72,7 +72,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
|
||||
context 'when it is an authenticated user' do
|
||||
let(:params) do
|
||||
{
|
||||
'name': 'Add label, send message and close the chat',
|
||||
'name': 'Add label, send message and close the chat, remove label',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': :add_label,
|
||||
@@ -84,6 +84,10 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
|
||||
},
|
||||
{
|
||||
'action_name': :resolve_conversation
|
||||
},
|
||||
{
|
||||
'action_name': :remove_label,
|
||||
'action_params': %w[support]
|
||||
}
|
||||
],
|
||||
visibility: 'global',
|
||||
@@ -348,6 +352,20 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
|
||||
expect(conversation.reload.status).to eql('snoozed')
|
||||
end
|
||||
|
||||
it 'Remove selected label' do
|
||||
macro.update!(actions: [{ 'action_name' => 'remove_label', 'action_params' => ['support'] }])
|
||||
conversation.add_labels(%w[support priority_customer])
|
||||
expect(conversation.label_list).to match_array(%w[support priority_customer])
|
||||
|
||||
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.label_list).to match_array(%w[priority_customer])
|
||||
end
|
||||
|
||||
it 'Adds the private note' do
|
||||
expect(conversation.messages).to be_empty
|
||||
|
||||
|
||||
Reference in New Issue
Block a user