diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-07-09 03:27:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-09 03:27:35 +0200 |
commit | 4e921832272425352d28cad550bfc4dffd6d0e78 (patch) | |
tree | c315a0b9dda8b69b6512c79711e896a18756f701 /app/services/activitypub/fetch_remote_account_service.rb | |
parent | 1e7187f2a8e0b9ffe4e7d6b06e9f70674c50471e (diff) |
Refactor domain block checks (#11268)
Diffstat (limited to 'app/services/activitypub/fetch_remote_account_service.rb')
-rw-r--r-- | app/services/activitypub/fetch_remote_account_service.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/services/activitypub/fetch_remote_account_service.rb b/app/services/activitypub/fetch_remote_account_service.rb index 3c2044941..d65c8f951 100644 --- a/app/services/activitypub/fetch_remote_account_service.rb +++ b/app/services/activitypub/fetch_remote_account_service.rb @@ -2,18 +2,22 @@ class ActivityPub::FetchRemoteAccountService < BaseService include JsonLdHelper + include DomainControlHelper SUPPORTED_TYPES = %w(Application Group Organization Person Service).freeze # Does a WebFinger roundtrip on each call, unless `only_key` is true def call(uri, id: true, prefetched_body: nil, break_on_redirect: false, only_key: false) + return if domain_not_allowed?(uri) return ActivityPub::TagManager.instance.uri_to_resource(uri, Account) if ActivityPub::TagManager.instance.local_uri?(uri) - @json = if prefetched_body.nil? - fetch_resource(uri, id) - else - body_to_json(prefetched_body, compare_id: id ? uri : nil) - end + @json = begin + if prefetched_body.nil? + fetch_resource(uri, id) + else + body_to_json(prefetched_body, compare_id: id ? uri : nil) + end + end return if !supported_context? || !expected_type? || (break_on_redirect && @json['movedTo'].present?) |