feat: Enable Slack Integration in all channels (#1175)
This commit is contained in:
@@ -80,7 +80,7 @@ class Integrations::Slack::IncomingMessageBuilder
|
||||
account_id: conversation.account_id,
|
||||
inbox_id: conversation.inbox_id,
|
||||
content: params[:event][:text],
|
||||
source_id: "slack_#{params[:event][:ts]}",
|
||||
external_source_id_slack: params[:event][:ts],
|
||||
private: private_note?,
|
||||
sender: sender
|
||||
)
|
||||
|
||||
@@ -4,9 +4,9 @@ class Integrations::Slack::SendOnSlackService < Base::SendOnChannelService
|
||||
def perform
|
||||
# overriding the base class logic since the validations are different in this case.
|
||||
# FIXME: for now we will only send messages from widget to slack
|
||||
return unless channel.is_a?(Channel::WebWidget)
|
||||
return unless valid_channel_for_slack?
|
||||
# we don't want message loop in slack
|
||||
return if message.source_id.try(:starts_with?, 'slack_')
|
||||
return if message.external_source_id_slack.present?
|
||||
# we don't want to start slack thread from agent conversation as of now
|
||||
return if message.outgoing? && conversation.identifier.blank?
|
||||
|
||||
@@ -15,6 +15,13 @@ class Integrations::Slack::SendOnSlackService < Base::SendOnChannelService
|
||||
|
||||
private
|
||||
|
||||
def valid_channel_for_slack?
|
||||
# slack wouldn't be an idean interface to reply to tweets, hence disabling that case
|
||||
return false if channel.is_a?(Channel::TwitterProfile) && conversation.additional_attributes['type'] == 'tweet'
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def perform_reply
|
||||
send_message
|
||||
update_reference_id
|
||||
|
||||
Reference in New Issue
Block a user