fix: Update Slack integration to fix message delivery issues (#6093)

This commit is contained in:
Pranav Raj S
2022-12-17 16:41:11 -08:00
committed by GitHub
parent 4d2b7c37a0
commit 38587b3aa1
6 changed files with 52 additions and 9 deletions

View File

@@ -22,13 +22,23 @@ class Integrations::Slack::IncomingMessageBuilder
private
def valid_event?
supported_event_type? && supported_event?
supported_event_type? && supported_event? && should_process_event?
end
def supported_event_type?
SUPPORTED_EVENT_TYPES.include?(params[:type])
end
# Discard all the subtype of a message event
# We are only considering the actual message sent by a Slack user
# Any reactions or messages sent by the bot will be ignored.
# https://api.slack.com/events/message#subtypes
def should_process_event?
return true if params[:type] != 'event_callback'
params[:event][:user].present? && params[:event][:subtype].blank?
end
def supported_event?
hook_verification? || SUPPORTED_EVENTS.include?(params[:event][:type])
end