chore: Macros enhancement (#5609)

- Fixed send_attachment and send_email_transcript
- Fixed duplicate activity messages
- Fixed Order of execution

Fixes: #5584
This commit is contained in:
Tejaswini Chile
2022-10-21 08:11:48 +05:30
committed by GitHub
parent 4d0b302802
commit a274a1702a
9 changed files with 113 additions and 28 deletions

View File

@@ -26,21 +26,15 @@ class AutomationRules::ActionService < ActionService
return unless @rule.files.attached?
blob = ActiveStorage::Blob.find(blob_ids)
blobs = ActiveStorage::Blob.where(id: blob_ids)
return if blob.blank?
return if blobs.blank?
params = { content: nil, private: false, attachments: 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
end
end
def send_webhook_event(webhook_url)
payload = @conversation.webhook_data.merge(event: "automation_event.#{@rule.event_name}")
WebhookJob.perform_later(webhook_url[0], payload)