From 84d991988eb076a7d83c771b3266f66f1c8a9754 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 28 Apr 2022 20:19:10 +0200 Subject: Fix temporary network/remote server error prevent from interactions with remote accounts (#18161) * Fix temporary network/remote server error prevent from interactions with remote accounts * Fix and add tests --- app/services/resolve_url_service.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/services/resolve_url_service.rb') diff --git a/app/services/resolve_url_service.rb b/app/services/resolve_url_service.rb index 5981e4d98..e2c745673 100644 --- a/app/services/resolve_url_service.rb +++ b/app/services/resolve_url_service.rb @@ -30,6 +30,11 @@ class ResolveURLService < BaseService end def process_url_from_db + if [500, 502, 503, 504, nil].include?(fetch_resource_service.response_code) + account = Account.find_by(uri: @url) + return account unless account.nil? + end + return unless @on_behalf_of.present? && [401, 403, 404].include?(fetch_resource_service.response_code) # It may happen that the resource is a private toot, and thus not fetchable, -- cgit