fix: use response.status instead of success (#6906)

* fix: use response.status instead of success

* refactor: use sentry to capture exception

* refactor: explicitly convert to i
This commit is contained in:
Shivam Mishra
2023-04-14 15:22:08 +05:30
committed by GitHub
parent 2b736f4698
commit 4d49b81f1c

View File

@@ -14,7 +14,7 @@ class Twitter::CallbacksController < Twitter::BaseController
redirect_to app_twitter_inbox_agents_url(account_id: account.id, inbox_id: inbox.id)
end
rescue StandardError => e
Rails.logger.error e
ChatwootExceptionTracker.new(e).capture_exception
redirect_to twitter_app_redirect_url
end
@@ -60,7 +60,7 @@ class Twitter::CallbacksController < Twitter::BaseController
def save_profile_image(inbox)
response = twitter_client.user_show(screen_name: inbox.name)
return unless response.success?
return unless response.status.to_i == 200
parsed_user_profile = JSON.parse(response.read_body)