fix: Disable automation on tweets (#4571)

Fixes #4565
This commit is contained in:
Pranav Raj S
2022-04-27 20:10:40 +05:30
committed by GitHub
parent 95c7a24dd1
commit 8348392d43
2 changed files with 66 additions and 54 deletions

View File

@@ -22,6 +22,8 @@ class AutomationRules::ActionService
private
def send_attachment(blob_ids)
return if conversation_a_tweet?
return unless @rule.files.attached?
blob = ActiveStorage::Blob.find(blob_ids)
@@ -61,6 +63,8 @@ class AutomationRules::ActionService
end
def send_message(message)
return if conversation_a_tweet?
params = { content: message[0], private: false, content_attributes: { automation_rule_id: @rule.id } }
mb = Messages::MessageBuilder.new(nil, @conversation, params)
mb.perform
@@ -101,4 +105,10 @@ class AutomationRules::ActionService
def team_belongs_to_account?(team_ids)
@account.team_ids.include?(team_ids[0])
end
def conversation_a_tweet?
return false if @conversation.additional_attributes.blank?
@conversation.additional_attributes['type'] == 'tweet'
end
end