0
0
Fork 0

Refactor reply-fetching code and disable it by default (#34147)

This commit is contained in:
Claire 2025-03-12 11:28:06 +01:00 committed by GitHub
parent 46e13dd81c
commit 9db26db495
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 15 additions and 35 deletions

View file

@ -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)