about summary refs log tree commit diff
path: root/app/lib/activitypub/activity.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/activitypub/activity.rb')
-rw-r--r--app/lib/activitypub/activity.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb
index 12e925965..9366cc984 100644
--- a/app/lib/activitypub/activity.rb
+++ b/app/lib/activitypub/activity.rb
@@ -205,6 +205,12 @@ class ActivityPub::Activity
     account.manual_only?
   end
 
+  def blocked?
+    uri = object_uri.start_with?('http') ? object_uri : @object['url']
+    domain = uri.scan(/[\w\-]+\.[\w\-]+(?:\.[\w\-]+)*/).first
+    domain.blank? ? true : DomainBlock.suspend?(domain)
+  end
+
   def reject_payload!
     Rails.logger.info("Rejected #{@json['type']} activity #{@json['id']} from #{@account.uri}#{@options[:relayed_through_account] && "via #{@options[:relayed_through_account].uri}"}")
     nil