From ac6de50b4d49c0bfbed7b733261f833b7e87ce88 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Thu, 20 Apr 2023 18:10:05 +0530 Subject: [PATCH] feat: Add a condition for filters based on the priority of automation (#6939) --- .../dashboard/helper/automationHelper.js | 1 + .../i18n/locale/en/advancedFilters.json | 1 + .../settings/automation/constants.js | 21 +++++++++++++++++++ app/models/automation_rule.rb | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/helper/automationHelper.js b/app/javascript/dashboard/helper/automationHelper.js index dc26177ff..cb68cbd43 100644 --- a/app/javascript/dashboard/helper/automationHelper.js +++ b/app/javascript/dashboard/helper/automationHelper.js @@ -163,6 +163,7 @@ export const getConditionOptions = ({ conversation_language: languages, country_code: countries, message_type: MESSAGE_CONDITION_VALUES, + priority: PRIORITY_CONDITION_VALUES, }; return conditionFilterMaps[type]; diff --git a/app/javascript/dashboard/i18n/locale/en/advancedFilters.json b/app/javascript/dashboard/i18n/locale/en/advancedFilters.json index a32c1bd9d..361c0c8ae 100644 --- a/app/javascript/dashboard/i18n/locale/en/advancedFilters.json +++ b/app/javascript/dashboard/i18n/locale/en/advancedFilters.json @@ -38,6 +38,7 @@ "CAMPAIGN_NAME": "Campaign Name", "LABELS": "Labels", "BROWSER_LANGUAGE": "Browser Language", + "PRIORITY": "Priority", "COUNTRY_NAME": "Country Name", "REFERER_LINK": "Referer link", "CUSTOM_ATTRIBUTE_LIST": "List", diff --git a/app/javascript/dashboard/routes/dashboard/settings/automation/constants.js b/app/javascript/dashboard/routes/dashboard/settings/automation/constants.js index 4c19970d8..fc98e315a 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/automation/constants.js +++ b/app/javascript/dashboard/routes/dashboard/settings/automation/constants.js @@ -175,6 +175,13 @@ export const AUTOMATIONS = { inputType: 'multi_select', filterOperators: OPERATOR_TYPES_1, }, + { + key: 'priority', + name: 'Priority', + attributeI18nKey: 'PRIORITY', + inputType: 'multi_select', + filterOperators: OPERATOR_TYPES_1, + }, ], actions: [ { @@ -313,6 +320,13 @@ export const AUTOMATIONS = { inputType: 'multi_select', filterOperators: OPERATOR_TYPES_1, }, + { + key: 'priority', + name: 'Priority', + attributeI18nKey: 'PRIORITY', + inputType: 'multi_select', + filterOperators: OPERATOR_TYPES_1, + }, ], actions: [ { @@ -444,6 +458,13 @@ export const AUTOMATIONS = { inputType: 'multi_select', filterOperators: OPERATOR_TYPES_1, }, + { + key: 'priority', + name: 'Priority', + attributeI18nKey: 'PRIORITY', + inputType: 'multi_select', + filterOperators: OPERATOR_TYPES_1, + }, ], actions: [ { diff --git a/app/models/automation_rule.rb b/app/models/automation_rule.rb index 0628a8b7e..0159ff846 100644 --- a/app/models/automation_rule.rb +++ b/app/models/automation_rule.rb @@ -31,7 +31,7 @@ class AutomationRule < ApplicationRecord scope :active, -> { where(active: true) } 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 conversation_language].freeze + 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