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:
Sojan Jose
2026-04-16 15:57:41 +05:30
committed by GitHub
parent 72b8a31f2d
commit aee979ee0b
19 changed files with 198 additions and 19 deletions

View File

@@ -40,9 +40,10 @@ class AutomationRule < ApplicationRecord
end
def actions_attributes
%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 open_conversation pending_conversation snooze_conversation change_priority
send_email_transcript add_private_note].freeze
%w[send_message add_label remove_label send_email_to_team assign_team assign_agent remove_assigned_agent
remove_assigned_team send_webhook_event mute_conversation send_attachment change_status resolve_conversation
open_conversation pending_conversation snooze_conversation change_priority send_email_transcript
add_private_note].freeze
end
def file_base_data

View File

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