feat: allow automation rules to remove labels (#8346)

This commit is contained in:
Shivam Mishra
2023-11-13 13:10:55 +05:30
committed by GitHub
parent 6c79642450
commit cd217a3f86
3 changed files with 13 additions and 2 deletions

View File

@@ -135,6 +135,7 @@ export const getActionOptions = ({ agents, teams, labels, type }) => {
assign_team: teams,
send_email_to_team: teams,
add_label: generateConditionOptions(labels, 'title'),
remove_label: generateConditionOptions(labels, 'title'),
change_priority: PRIORITY_CONDITION_VALUES,
};
return actionsMap[type];

View File

@@ -67,6 +67,11 @@ export const AUTOMATIONS = {
name: 'Add a label',
attributeI18nKey: 'ADD_LABEL',
},
{
key: 'remove_label',
name: 'Remove a label',
attributeI18nKey: 'REMOVE_LABEL',
},
{
key: 'send_email_to_team',
name: 'Send an email to team',
@@ -556,6 +561,11 @@ export const AUTOMATION_ACTION_TYPES = [
label: 'Add a label',
inputType: 'multi_select',
},
{
key: 'remove_label',
label: 'Remove a label',
inputType: 'multi_select',
},
{
key: 'send_email_to_team',
label: 'Send an email to team',

View File

@@ -32,8 +32,8 @@ class AutomationRule < ApplicationRecord
CONDITIONS_ATTRS = %w[content email country_code status message_type browser_language assignee_id team_id referer city company inbox_id
mail_subject phone_number priority conversation_language].freeze
ACTIONS_ATTRS = %w[send_message add_label send_email_to_team assign_team assign_agent send_webhook_event mute_conversation send_attachment
change_status resolve_conversation snooze_conversation change_priority send_email_transcript].freeze
ACTIONS_ATTRS = %w[send_message add_label remove_label send_email_to_team assign_team assign_agent send_webhook_event mute_conversation
send_attachment change_status resolve_conversation snooze_conversation change_priority send_email_transcript].freeze
def file_base_data
files.map do |file|