chore: apply rubocop

This commit is contained in:
gabrieljablonski 2025-04-09 19:25:21 -03:00
parent 65430e4633
commit 4935563b60
5 changed files with 6 additions and 6 deletions

View File

@ -161,7 +161,7 @@ class Messages::Instagram::BaseMessageBuilder < Messages::Messenger::MessageBuil
end
def all_unsupported_files?
return if attachments.empty?
return false if attachments.empty?
attachments_type = attachments.pluck(:type).uniq.first
unsupported_file_type?(attachments_type)

View File

@ -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
if error_code == 1_609_005
@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
Rails.logger.error("[InstagramStoryFetchError]: #{parsed_response.dig('error', 'message')} #{error_code}")

View File

@ -14,7 +14,7 @@ class Messages::Instagram::Messenger::MessageBuilder < Messages::Instagram::Base
rescue Koala::Facebook::ClientError => e
# The exception occurs when we are trying fetch the deleted story or blocked story.
@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
{}
rescue StandardError => e

View File

@ -29,7 +29,7 @@ describe Messages::Instagram::MessageBuilder do
describe '#perform' 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\?.*})
.to_return(
@ -175,7 +175,7 @@ describe Messages::Instagram::MessageBuilder do
end
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_request(:get, %r{https://graph\.instagram\.com/.*?/Sender-id-1\?.*})

View File

@ -182,7 +182,7 @@ describe Webhooks::InstagramEventsJob do
context 'when handling messaging events for Instagram via Instagram login' 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\?.*})
.to_return(