diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-10-20 08:02:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-20 08:02:44 +0200 |
commit | fd5285658f477c5b6a9c7af0935b5c889729b2e0 (patch) | |
tree | 42f11c5da1570ddfc6820e5bab6b22202c24c158 /app/lib/activitypub/activity | |
parent | d5bfba3262cf531d767f583a79fc2fbe8bff93b4 (diff) |
Add option to block reports from domain (#8830)
Diffstat (limited to 'app/lib/activitypub/activity')
-rw-r--r-- | app/lib/activitypub/activity/flag.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/lib/activitypub/activity/flag.rb b/app/lib/activitypub/activity/flag.rb index 36d3c5730..92e59bb81 100644 --- a/app/lib/activitypub/activity/flag.rb +++ b/app/lib/activitypub/activity/flag.rb @@ -2,6 +2,8 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity def perform + return if skip_reports? + target_accounts = object_uris.map { |uri| account_from_uri(uri) }.compact.select(&:local?) target_statuses_by_account = object_uris.map { |uri| status_from_uri(uri) }.compact.select(&:local?).group_by(&:account_id) @@ -19,6 +21,12 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity end end + private + + def skip_reports? + DomainBlock.find_by(domain: @account.domain)&.reject_reports? + end + def object_uris @object_uris ||= Array(@object.is_a?(Array) ? @object.map { |item| value_or_id(item) } : value_or_id(@object)) end |