chore: apply rubocop
This commit is contained in:
parent
65430e4633
commit
4935563b60
@ -161,7 +161,7 @@ class Messages::Instagram::BaseMessageBuilder < Messages::Messenger::MessageBuil
|
|||||||
end
|
end
|
||||||
|
|
||||||
def all_unsupported_files?
|
def all_unsupported_files?
|
||||||
return if attachments.empty?
|
return false if attachments.empty?
|
||||||
|
|
||||||
attachments_type = attachments.pluck(:type).uniq.first
|
attachments_type = attachments.pluck(:type).uniq.first
|
||||||
unsupported_file_type?(attachments_type)
|
unsupported_file_type?(attachments_type)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class Messages::Instagram::MessageBuilder < Messages::Instagram::BaseMessageBuil
|
|||||||
# https://developers.facebook.com/docs/graph-api/guides/error-handling/ search for error code 1609005
|
# https://developers.facebook.com/docs/graph-api/guides/error-handling/ search for error code 1609005
|
||||||
if error_code == 1_609_005
|
if error_code == 1_609_005
|
||||||
@message.attachments.destroy_all
|
@message.attachments.destroy_all
|
||||||
@message.update(content: I18n.t('conversations.messages.instagram_deleted_story_content'))
|
@message.update!(content: I18n.t('conversations.messages.instagram_deleted_story_content'))
|
||||||
end
|
end
|
||||||
|
|
||||||
Rails.logger.error("[InstagramStoryFetchError]: #{parsed_response.dig('error', 'message')} #{error_code}")
|
Rails.logger.error("[InstagramStoryFetchError]: #{parsed_response.dig('error', 'message')} #{error_code}")
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class Messages::Instagram::Messenger::MessageBuilder < Messages::Instagram::Base
|
|||||||
rescue Koala::Facebook::ClientError => e
|
rescue Koala::Facebook::ClientError => e
|
||||||
# The exception occurs when we are trying fetch the deleted story or blocked story.
|
# The exception occurs when we are trying fetch the deleted story or blocked story.
|
||||||
@message.attachments.destroy_all
|
@message.attachments.destroy_all
|
||||||
@message.update(content: I18n.t('conversations.messages.instagram_deleted_story_content'))
|
@message.update!(content: I18n.t('conversations.messages.instagram_deleted_story_content'))
|
||||||
Rails.logger.error e
|
Rails.logger.error e
|
||||||
{}
|
{}
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
|
|||||||
@ -29,7 +29,7 @@ describe Messages::Instagram::MessageBuilder do
|
|||||||
|
|
||||||
describe '#perform' do
|
describe '#perform' do
|
||||||
before do
|
before do
|
||||||
instagram_channel.update(access_token: 'valid_instagram_token')
|
instagram_channel.update!(access_token: 'valid_instagram_token')
|
||||||
|
|
||||||
stub_request(:get, %r{https://graph\.instagram\.com/.*?/Sender-id-1\?.*})
|
stub_request(:get, %r{https://graph\.instagram\.com/.*?/Sender-id-1\?.*})
|
||||||
.to_return(
|
.to_return(
|
||||||
@ -175,7 +175,7 @@ describe Messages::Instagram::MessageBuilder do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'handles authorization errors' do
|
it 'handles authorization errors' do
|
||||||
instagram_channel.update(access_token: 'invalid_token')
|
instagram_channel.update!(access_token: 'invalid_token')
|
||||||
|
|
||||||
# Stub the request to return authorization error status
|
# Stub the request to return authorization error status
|
||||||
stub_request(:get, %r{https://graph\.instagram\.com/.*?/Sender-id-1\?.*})
|
stub_request(:get, %r{https://graph\.instagram\.com/.*?/Sender-id-1\?.*})
|
||||||
|
|||||||
@ -182,7 +182,7 @@ describe Webhooks::InstagramEventsJob do
|
|||||||
|
|
||||||
context 'when handling messaging events for Instagram via Instagram login' do
|
context 'when handling messaging events for Instagram via Instagram login' do
|
||||||
before do
|
before do
|
||||||
instagram_channel.update(access_token: 'valid_instagram_token')
|
instagram_channel.update!(access_token: 'valid_instagram_token')
|
||||||
|
|
||||||
stub_request(:get, %r{https://graph\.instagram\.com/v22\.0/Sender-id-1\?.*})
|
stub_request(:get, %r{https://graph\.instagram\.com/v22\.0/Sender-id-1\?.*})
|
||||||
.to_return(
|
.to_return(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user