mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 20:18:08 +00:00
Fix: sentry issue for slack incoming files check (#4656)
Interpreter error for nil. any? added nil. present? Fixes: https://sentry.io/share/issue/48c10d26490f4bdaab78c82244fcea98/
This commit is contained in:
@@ -37,7 +37,7 @@ class Integrations::Slack::IncomingMessageBuilder
|
||||
if message.present?
|
||||
SUPPORTED_MESSAGE_TYPES.include?(message[:type]) && !attached_file_message?
|
||||
else
|
||||
params[:event][:files].any? && !attached_file_message?
|
||||
params[:event][:files].present? && !attached_file_message?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -61,6 +61,15 @@ describe Integrations::Slack::IncomingMessageBuilder do
|
||||
expect(conversation.messages.count).to eql(messages_count)
|
||||
end
|
||||
|
||||
it 'does not create message for invalid event type and event files is not present' do
|
||||
messages_count = conversation.messages.count
|
||||
message_with_attachments[:event][:files] = nil
|
||||
builder = described_class.new(message_with_attachments)
|
||||
allow(builder).to receive(:sender).and_return(nil)
|
||||
builder.perform
|
||||
expect(conversation.messages.count).to eql(messages_count)
|
||||
end
|
||||
|
||||
it 'saves attachment if params files present' do
|
||||
expect(hook).not_to eq nil
|
||||
messages_count = conversation.messages.count
|
||||
|
||||
Reference in New Issue
Block a user