Feat: attachments automation (#4266)

This commit is contained in:
Tejaswini Chile
2022-03-30 08:08:58 +05:30
committed by GitHub
parent 3f2ac2042f
commit 15fd37b124
5 changed files with 135 additions and 15 deletions

View File

@@ -21,6 +21,15 @@ class AutomationRules::ActionService
private
def send_attachments(_file_params)
return if @rule.event_name == 'message_created'
blobs = @rule.files.map { |file, _| file.blob }
params = { content: nil, private: false, attachments: blobs }
mb = Messages::MessageBuilder.new(nil, @conversation, params)
mb.perform
end
def send_email_transcript(emails)
emails.each do |email|
ConversationReplyMailer.with(account: @conversation.account).conversation_transcript(@conversation, email)&.deliver_later
@@ -48,7 +57,7 @@ class AutomationRules::ActionService
return if @rule.event_name == 'message_created'
params = { content: message[0], private: false }
mb = Messages::MessageBuilder.new(@administrator, @conversation, params)
mb = Messages::MessageBuilder.new(nil, @conversation, params)
mb.perform
end
@@ -85,10 +94,6 @@ class AutomationRules::ActionService
end
end
def administrator
@administrator ||= @account.administrators.first
end
def agent_belongs_to_account?(agent_ids)
@account.agents.pluck(:id).include?(agent_ids[0])
end