Feat/5733 Add private note action in macros (#5805)
This commit is contained in:
@@ -53,6 +53,7 @@ export default {
|
||||
send_webhook_event: params[0],
|
||||
send_message: params[0],
|
||||
send_email_transcript: params[0],
|
||||
add_private_note: params[0],
|
||||
};
|
||||
return actionsMap[key] || '';
|
||||
},
|
||||
|
||||
@@ -39,4 +39,9 @@ export const MACRO_ACTION_TYPES = [
|
||||
label: 'Send a message',
|
||||
inputType: 'textarea',
|
||||
},
|
||||
{
|
||||
key: 'add_private_note',
|
||||
label: 'Add a private note',
|
||||
inputType: 'textarea',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -33,7 +33,7 @@ class Macro < ApplicationRecord
|
||||
validate :json_actions_format
|
||||
|
||||
ACTIONS_ATTRS = %w[send_message add_label assign_team assign_best_agent mute_conversation change_status
|
||||
resolve_conversation snooze_conversation send_email_transcript send_attachment].freeze
|
||||
resolve_conversation snooze_conversation send_email_transcript send_attachment add_private_note].freeze
|
||||
|
||||
def set_visibility(user, params)
|
||||
self.visibility = params[:visibility]
|
||||
|
||||
@@ -22,6 +22,16 @@ class Macros::ExecutionService < ActionService
|
||||
|
||||
private
|
||||
|
||||
def add_private_note(message)
|
||||
return if conversation_a_tweet?
|
||||
|
||||
params = { content: message[0], private: true }
|
||||
|
||||
# Added reload here to ensure conversation us persistent with the latest updates
|
||||
mb = Messages::MessageBuilder.new(@user, @conversation.reload, params)
|
||||
mb.perform
|
||||
end
|
||||
|
||||
def send_message(message)
|
||||
return if conversation_a_tweet?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user