feat: Add an action in Macro to change the priority (#6940)

This commit is contained in:
Muhsin Keloth
2023-04-24 17:14:30 +05:30
committed by GitHub
parent e3193dcabc
commit f1fc658a0d
5 changed files with 14 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ describe('#resolveActionName', () => {
expect(resolveActionName(MACRO_ACTION_TYPES[1].key)).not.toEqual( expect(resolveActionName(MACRO_ACTION_TYPES[1].key)).not.toEqual(
MACRO_ACTION_TYPES[0].label MACRO_ACTION_TYPES[0].label
); );
expect(resolveActionName('change_priority')).toEqual('Change Priority');
}); });
}); });

View File

@@ -1,3 +1,4 @@
import { PRIORITY_CONDITION_VALUES } from 'dashboard/helper/automationHelper.js';
export default { export default {
methods: { methods: {
getDropdownValues(type) { getDropdownValues(type) {
@@ -15,6 +16,8 @@ export default {
name: i.title, name: i.title,
}; };
}); });
case 'change_priority':
return PRIORITY_CONDITION_VALUES;
default: default:
return []; return [];
} }

View File

@@ -2,6 +2,7 @@ import { createWrapper } from '@vue/test-utils';
import macrosMixin from '../macrosMixin'; import macrosMixin from '../macrosMixin';
import Vue from 'vue'; import Vue from 'vue';
import { teams, labels, agents } from '../../helper/specs/macrosFixtures'; import { teams, labels, agents } from '../../helper/specs/macrosFixtures';
import { PRIORITY_CONDITION_VALUES } from 'dashboard/helper/automationHelper.js';
describe('webhookMixin', () => { describe('webhookMixin', () => {
describe('#getEventLabel', () => { describe('#getEventLabel', () => {
it('returns correct i18n translation:', () => { it('returns correct i18n translation:', () => {
@@ -37,6 +38,9 @@ describe('webhookMixin', () => {
expect(wrapper.vm.getDropdownValues('send_email_to_team')).toEqual(teams); expect(wrapper.vm.getDropdownValues('send_email_to_team')).toEqual(teams);
expect(wrapper.vm.getDropdownValues('add_label')).toEqual(resolvedLabels); expect(wrapper.vm.getDropdownValues('add_label')).toEqual(resolvedLabels);
expect(wrapper.vm.getDropdownValues('assign_agent')).toEqual(agents); expect(wrapper.vm.getDropdownValues('assign_agent')).toEqual(agents);
expect(wrapper.vm.getDropdownValues('change_priority')).toEqual(
PRIORITY_CONDITION_VALUES
);
expect(wrapper.vm.getDropdownValues()).toEqual([]); expect(wrapper.vm.getDropdownValues()).toEqual([]);
}); });
}); });

View File

@@ -59,4 +59,9 @@ export const MACRO_ACTION_TYPES = [
label: 'Add a private note', label: 'Add a private note',
inputType: 'textarea', inputType: 'textarea',
}, },
{
key: 'change_priority',
label: 'Change Priority',
inputType: 'search_select',
},
]; ];

View File

@@ -31,7 +31,7 @@ class Macro < ApplicationRecord
validate :json_actions_format validate :json_actions_format
ACTIONS_ATTRS = %w[send_message add_label assign_team assign_agent mute_conversation change_status remove_label remove_assigned_team ACTIONS_ATTRS = %w[send_message add_label assign_team assign_agent mute_conversation change_status remove_label remove_assigned_team
resolve_conversation snooze_conversation send_email_transcript send_attachment add_private_note].freeze resolve_conversation snooze_conversation change_priority send_email_transcript send_attachment add_private_note].freeze
def set_visibility(user, params) def set_visibility(user, params)
self.visibility = params[:visibility] self.visibility = params[:visibility]