about summary refs log tree commit diff
path: root/app/services/activitypub/fetch_remote_account_service.rb
diff options
context:
space:
mode:
authorReverite <github@reverite.sh>2019-07-20 18:46:40 -0700
committerReverite <github@reverite.sh>2019-07-20 18:46:40 -0700
commit266540080ef5659060faa7da502123f45bbc04f2 (patch)
tree1c34751dd4e199737b7a2a4c511b756760941c52 /app/services/activitypub/fetch_remote_account_service.rb
parent40fd56351f0a466e0e3785cca4ee27f2a9060e8a (diff)
parentf1597e1ab90b1fb291f16977877c6ca79bf89676 (diff)
Merge branch 'glitch' into production
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 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?)