fix: add explicit remove assignment actions to macros and automations (#12172)
This updates macros and automations so agents can explicitly remove assigned agents or teams, while keeping the existing `Assign -> None` flow working for backward compatibility. Fixes: #7551 Closes: #7551 ## Why The original macro change exposed unassignment only through `Assign -> None`, which made macros behave differently from automations and left the explicit remove actions inconsistent across the product. This keeps the lower-risk compatibility path and adds the explicit remove actions requested in review. ## What this change does - Adds `Remove Assigned Agent` and `Remove Assigned Team` as explicit actions in macros. - Adds the same explicit remove actions in automations. - Keeps `Assign Agent -> None` and `Assign Team -> None` working for existing behavior and stored payloads. - Preserves backward compatibility for existing macro and automation execution payloads. - Downmerges the latest `develop` and resolves the conflicts while keeping both the new remove actions and current `develop` behavior. ## Validation - Verified both remove actions are available and selectable in the macro editor. - Verified both remove actions are available and selectable in the automation builder. - Applied a disposable macro with `Remove Assigned Agent` and `Remove Assigned Team` on a real conversation and confirmed both fields were cleared. - Applied a disposable macro with `Assign Agent -> None` and `Assign Team -> None` on a real conversation and confirmed both fields were still cleared.
This commit is contained in:
@@ -25,6 +25,7 @@ const getActionValue = (key, params) => {
|
||||
add_label: resolveLabels(labels.value, params),
|
||||
remove_label: resolveLabels(labels.value, params),
|
||||
assign_agent: resolveAgents(agents.value, params),
|
||||
remove_assigned_agent: null,
|
||||
mute_conversation: null,
|
||||
snooze_conversation: null,
|
||||
resolve_conversation: null,
|
||||
|
||||
@@ -90,6 +90,14 @@ export const AUTOMATIONS = {
|
||||
key: 'assign_team',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_agent',
|
||||
name: 'REMOVE_ASSIGNED_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
name: 'REMOVE_ASSIGNED_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'add_label',
|
||||
name: 'ADD_LABEL',
|
||||
@@ -218,6 +226,14 @@ export const AUTOMATIONS = {
|
||||
key: 'assign_team',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_agent',
|
||||
name: 'REMOVE_ASSIGNED_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
name: 'REMOVE_ASSIGNED_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'ASSIGN_AGENT',
|
||||
@@ -350,6 +366,14 @@ export const AUTOMATIONS = {
|
||||
key: 'assign_team',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_agent',
|
||||
name: 'REMOVE_ASSIGNED_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
name: 'REMOVE_ASSIGNED_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'ASSIGN_AGENT',
|
||||
@@ -476,6 +500,14 @@ export const AUTOMATIONS = {
|
||||
key: 'assign_team',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_agent',
|
||||
name: 'REMOVE_ASSIGNED_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
name: 'REMOVE_ASSIGNED_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'ASSIGN_AGENT',
|
||||
@@ -592,6 +624,14 @@ export const AUTOMATIONS = {
|
||||
key: 'assign_team',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_agent',
|
||||
name: 'REMOVE_ASSIGNED_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
name: 'REMOVE_ASSIGNED_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'send_email_to_team',
|
||||
name: 'SEND_EMAIL_TO_TEAM',
|
||||
@@ -650,6 +690,16 @@ export const AUTOMATION_ACTION_TYPES = [
|
||||
label: 'ASSIGN_TEAM',
|
||||
inputType: 'search_select',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_agent',
|
||||
label: 'REMOVE_ASSIGNED_AGENT',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
label: 'REMOVE_ASSIGNED_TEAM',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'add_label',
|
||||
label: 'ADD_LABEL',
|
||||
|
||||
@@ -19,6 +19,11 @@ export const MACRO_ACTION_TYPES = [
|
||||
label: 'REMOVE_LABEL',
|
||||
inputType: 'multi_select',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_agent',
|
||||
label: 'REMOVE_ASSIGNED_AGENT',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
label: 'REMOVE_ASSIGNED_TEAM',
|
||||
|
||||
@@ -17,6 +17,7 @@ export const resolveActionName = key => {
|
||||
export const resolveTeamIds = (teams, ids) => {
|
||||
return ids
|
||||
.map(id => {
|
||||
if (id === 'nil') return 'None';
|
||||
const team = teams.find(i => i.id === id);
|
||||
return team ? team.name : '';
|
||||
})
|
||||
@@ -35,6 +36,8 @@ export const resolveLabels = (labels, ids) => {
|
||||
export const resolveAgents = (agents, ids) => {
|
||||
return ids
|
||||
.map(id => {
|
||||
if (id === 'nil') return 'None';
|
||||
if (id === 'self') return 'Self';
|
||||
const agent = agents.find(i => i.id === id);
|
||||
return agent ? agent.name : '';
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user