about summary refs log tree commit diff
path: root/app/services/activitypub/fetch_remote_account_service.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-07-21 00:53:28 +0200
committerHolly 'Frinkel' Lotor <admin@frinkel.tech>2020-01-20 16:55:55 -0500
commitb0630ddc8261250c5edbf2907648695041649e98 (patch)
tree9ca374e4e98598efced200e4a993875245ab93b6 /app/services/activitypub/fetch_remote_account_service.rb
parent9447566b8ed8e532c13dd97ecd53681029fdcec0 (diff)
Original upstream merge
Diffstat (limited to 'app/services/activitypub/fetch_remote_account_service.rb')
-rw-r--r--app/services/activitypub/fetch_remote_account_service.rb14
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 df1e79d7d..381726c35 100644
--- a/app/services/activitypub/fetch_remote_account_service.rb
+++ b/app/services/activitypub/fetch_remote_account_service.rb
@@ -3,19 +3,23 @@
 class ActivityPub::FetchRemoteAccountService < BaseService
   include JsonLdHelper
   include AutorejectHelper
+  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)
 
     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
+    @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 autoreject?
     return if !supported_context? || !expected_type? || (break_on_redirect && @json['movedTo'].present?)