feat: Add None option in automation assign agent actions (#7900)

This commit is contained in:
Muhsin Keloth
2023-09-14 09:01:58 +05:30
committed by GitHub
parent 5e6e234afe
commit 2d4ef0c328
3 changed files with 26 additions and 1 deletions

View File

@@ -120,9 +120,18 @@ export const generateConditionOptions = (options, key = 'id') => {
});
};
// Add the "None" option to the agent list
export const agentList = agents => [
{
id: 'nil',
name: 'None',
},
...(agents || []),
];
export const getActionOptions = ({ agents, teams, labels, type }) => {
const actionsMap = {
assign_agent: agents,
assign_agent: agentList(agents),
assign_team: teams,
send_email_to_team: teams,
add_label: generateConditionOptions(labels, 'title'),

View File

@@ -32,6 +32,8 @@ class ActionService
end
def assign_agent(agent_ids = [])
return @conversation.update!(assignee_id: nil) if agent_ids[0] == 'nil'
return unless agent_belongs_to_inbox?(agent_ids)
@agent = @account.users.find_by(id: agent_ids)