mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-30 02:32:29 +00:00
chore: Rescue slack link unfurling errors. (#11033)
Fixes https://linear.app/chatwoot/issue/CW-4122/slackwebapierrorsmissingscope-missing-scope This PR adds the ability to handle errors when scopes are missing during link unfurling. Since link unfurling is just a nice-to-have feature that doesn't affect core functionality, we will silently ignore these errors. --------- Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
@@ -269,6 +269,19 @@ describe Integrations::Slack::SendOnSlackService do
|
||||
expect(hook).to be_disabled
|
||||
expect(hook).to have_received(:prompt_reauthorization!)
|
||||
end
|
||||
|
||||
it 'logs MissingScope error during link unfurl' do
|
||||
unflur_payload = { channel: 'channel', ts: 'timestamp', unfurls: {} }
|
||||
error = Slack::Web::Api::Errors::MissingScope.new('Missing required scope')
|
||||
|
||||
expect(slack_client).to receive(:chat_unfurl)
|
||||
.with(unflur_payload)
|
||||
.and_raise(error)
|
||||
|
||||
expect(Rails.logger).to receive(:warn).with('Slack: Missing scope error: Missing required scope')
|
||||
|
||||
link_builder.link_unfurl(unflur_payload)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when message contains mentions' do
|
||||
|
||||
Reference in New Issue
Block a user