Fix: slack repeated callback event message for attached files (#4610)

This commit is contained in:
Tejaswini Chile
2022-05-09 19:18:30 +05:30
committed by GitHub
parent 5ce29a7beb
commit 0eeab8c56c
2 changed files with 22 additions and 2 deletions

View File

@@ -35,9 +35,9 @@ class Integrations::Slack::IncomingMessageBuilder
def supported_message?
if message.present?
SUPPORTED_MESSAGE_TYPES.include?(message[:type])
SUPPORTED_MESSAGE_TYPES.include?(message[:type]) && !attached_file_message?
else
params.dig(:event, :files).any?
params[:event][:files].any? && !attached_file_message?
end
end
@@ -135,4 +135,12 @@ class Integrations::Slack::IncomingMessageBuilder
:file
end
end
# Ignoring the changes added here https://github.com/chatwoot/chatwoot/blob/5b5a6d89c0cf7f3148a1439d6fcd847784a79b94/lib/integrations/slack/send_on_slack_service.rb#L69
# This make sure 'Attached File!' comment is not visible on CW dashboard.
# This is showing because of https://github.com/chatwoot/chatwoot/pull/4494/commits/07a1c0da1e522d76e37b5f0cecdb4613389ab9b6 change.
# As now we consider the postback message with event[:files]
def attached_file_message?
params[:event][:text] == 'Attached File!'
end
end