Add domain block setting reject_favourite and reject_reply

This commit is contained in:
KMY 2023-04-27 12:04:10 +09:00
parent 27353bbaee
commit 6537405eab
15 changed files with 85 additions and 22 deletions

View file

@ -46,6 +46,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
def create_status
return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity?
return reject_payload! if reply_to_local? && reject_reply_to_local?
with_lock("create:#{object_uri}") do
return if delete_arrived_first?(object_uri) || poll_vote?
@ -392,6 +393,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
!replied_to_status.nil? && replied_to_status.account.local?
end
def reject_reply_to_local?
@reject_reply_to_local ||= DomainBlock.reject_reply?(@account.domain)
end
def related_to_local_activity?
fetch? || followed_by_local_accounts? || requested_through_relay? ||
responds_to_followed_account? || addresses_local_accounts?