Refactor reply-fetching code and disable it by default (#34147)
This commit is contained in:
parent
46e13dd81c
commit
9db26db495
7 changed files with 15 additions and 35 deletions
|
@ -83,13 +83,13 @@ class ActivityPub::FetchRemoteStatusService < BaseService
|
|||
|
||||
def fetch_status(uri, id_is_known, on_behalf_of = nil)
|
||||
begin
|
||||
fetch_resource(uri, id_is_known, on_behalf_of, raise_on_error: true)
|
||||
fetch_resource(uri, id_is_known, on_behalf_of, raise_on_error: :all)
|
||||
rescue Mastodon::UnexpectedResponseError => e
|
||||
return unless e.response.code == 404
|
||||
|
||||
# If this is a 404 from a status from an account that has no local followers, delete it
|
||||
existing_status = Status.find_by(uri: uri)
|
||||
if !existing_status.nil? && existing_status.unsubscribed? && existing_status.distributable?
|
||||
# If this is a 404 from a public status from a remote account, delete it
|
||||
existing_status = Status.remote.find_by(uri: uri)
|
||||
if existing_status&.distributable?
|
||||
Rails.logger.debug { "FetchRemoteStatusService - Got 404 for orphaned status with URI #{uri}, deleting" }
|
||||
Tombstone.find_or_create_by(uri: uri, account: existing_status.account)
|
||||
RemoveStatusService.new.call(existing_status, redraft: false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue