feat: Assign team with teams none option (#5871)
This commit is contained in:
@@ -54,6 +54,7 @@ export default {
|
||||
mute_conversation: null,
|
||||
snooze_conversation: null,
|
||||
resolve_conversation: null,
|
||||
remove_assigned_team: null,
|
||||
send_webhook_event: params[0],
|
||||
send_message: params[0],
|
||||
send_email_transcript: params[0],
|
||||
|
||||
@@ -41,8 +41,8 @@ export default {
|
||||
...mapGetters({
|
||||
uiFlags: 'macros/getUIFlags',
|
||||
labels: 'labels/getLabels',
|
||||
teams: 'teams/getTeams',
|
||||
agents: 'agents/getAgents',
|
||||
teams: 'teams/getTeams',
|
||||
}),
|
||||
macroId() {
|
||||
return this.$route.params.macroId;
|
||||
|
||||
@@ -84,7 +84,8 @@ export default {
|
||||
return !(
|
||||
prop.action_name === 'mute_conversation' ||
|
||||
prop.action_name === 'snooze_conversation' ||
|
||||
prop.action_name === 'resolve_conversation'
|
||||
prop.action_name === 'resolve_conversation' ||
|
||||
prop.action_name === 'remove_assigned_team'
|
||||
);
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -19,6 +19,11 @@ export const MACRO_ACTION_TYPES = [
|
||||
label: 'Remove a label',
|
||||
inputType: 'multi_select',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
label: 'Remove Assigned Team',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
label: 'Send an email transcript',
|
||||
|
||||
@@ -30,7 +30,7 @@ class Macro < ApplicationRecord
|
||||
|
||||
validate :json_actions_format
|
||||
|
||||
ACTIONS_ATTRS = %w[send_message add_label assign_team assign_agent mute_conversation change_status remove_label
|
||||
ACTIONS_ATTRS = %w[send_message add_label assign_team assign_agent mute_conversation change_status remove_label remove_assigned_team
|
||||
resolve_conversation snooze_conversation send_email_transcript send_attachment add_private_note].freeze
|
||||
|
||||
def set_visibility(user, params)
|
||||
|
||||
@@ -41,11 +41,16 @@ class ActionService
|
||||
end
|
||||
|
||||
def assign_team(team_ids = [])
|
||||
return unassign_team if team_ids[0].zero?
|
||||
return unless team_belongs_to_account?(team_ids)
|
||||
|
||||
@conversation.update!(team_id: team_ids[0])
|
||||
end
|
||||
|
||||
def remove_assigned_team(_params)
|
||||
@conversation.update!(team_id: nil)
|
||||
end
|
||||
|
||||
def send_email_transcript(emails)
|
||||
emails.each do |email|
|
||||
ConversationReplyMailer.with(account: @conversation.account).conversation_transcript(@conversation, email)&.deliver_later
|
||||
|
||||
Reference in New Issue
Block a user