From 2822fbc443addf08651961543e1a63abdd409d87 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 22 Jul 2019 21:12:54 -0500 Subject: move autoreject check to own module & check for reject before pulling resources --- app/services/activitypub/fetch_remote_account_service.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/services/activitypub/fetch_remote_account_service.rb') diff --git a/app/services/activitypub/fetch_remote_account_service.rb b/app/services/activitypub/fetch_remote_account_service.rb index 3c2044941..df1e79d7d 100644 --- a/app/services/activitypub/fetch_remote_account_service.rb +++ b/app/services/activitypub/fetch_remote_account_service.rb @@ -2,6 +2,7 @@ class ActivityPub::FetchRemoteAccountService < BaseService include JsonLdHelper + include AutorejectHelper SUPPORTED_TYPES = %w(Application Group Organization Person Service).freeze @@ -9,12 +10,14 @@ class ActivityPub::FetchRemoteAccountService < BaseService def call(uri, id: true, prefetched_body: nil, break_on_redirect: false, only_key: false) return ActivityPub::TagManager.instance.uri_to_resource(uri, Account) if ActivityPub::TagManager.instance.local_uri?(uri) + return if autoreject?(uri) @json = if prefetched_body.nil? fetch_resource(uri, id) else body_to_json(prefetched_body, compare_id: id ? uri : nil) end + return if autoreject? return if !supported_context? || !expected_type? || (break_on_redirect && @json['movedTo'].present?) @uri = @json['id'] @@ -59,4 +62,8 @@ class ActivityPub::FetchRemoteAccountService < BaseService def expected_type? equals_or_includes_any?(@json['type'], SUPPORTED_TYPES) end + + def object_uri + nil + end end -- cgit