mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
parent
a16d41e9fb
commit
221c8c771f
@ -7,14 +7,14 @@ class ActivityPub::FetchRemoteAccountService < BaseService
|
||||
|
||||
# Should be called when uri has already been checked for locality
|
||||
# Does a WebFinger roundtrip on each call
|
||||
def call(uri, id: true, prefetched_body: nil)
|
||||
def call(uri, id: true, prefetched_body: nil, break_on_redirect: false)
|
||||
@json = if prefetched_body.nil?
|
||||
fetch_resource(uri, id)
|
||||
else
|
||||
body_to_json(prefetched_body, compare_id: id ? uri : nil)
|
||||
end
|
||||
|
||||
return unless supported_context? && expected_type?
|
||||
return if !supported_context? || !expected_type? || (break_on_redirect && @json['movedTo'].present?)
|
||||
|
||||
@uri = @json['id']
|
||||
@username = @json['preferredUsername']
|
||||
|
@ -175,7 +175,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
||||
|
||||
def moved_account
|
||||
account = ActivityPub::TagManager.instance.uri_to_resource(@json['movedTo'], Account)
|
||||
account ||= ActivityPub::FetchRemoteAccountService.new.call(@json['movedTo'], id: true)
|
||||
account ||= ActivityPub::FetchRemoteAccountService.new.call(@json['movedTo'], id: true, break_on_redirect: true)
|
||||
account
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user