Merge branch 'kb_development' into kb_migration

This commit is contained in:
KMY 2023-05-07 14:11:18 +09:00
commit b7ef24d3e8
9 changed files with 46 additions and 20 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? || reply_to_local_account?) && reject_reply_to_local?
with_lock("create:#{object_uri}") do
return if delete_arrived_first?(object_uri) || poll_vote?
@ -136,7 +137,13 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
}
end
def process_audience
def reply_to_local_account?
accounts_in_audience.any?(&:local?)
end
def accounts_in_audience
return @accounts_in_audience if @accounts_in_audience
# Unlike with tags, there is no point in resolving accounts we don't already
# know here, because silent mentions would only be used for local access control anyway
accounts_in_audience = (audience_to + audience_cc).uniq.filter_map do |audience|
@ -150,6 +157,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
accounts_in_audience.uniq!
end
@accounts_in_audience = accounts_in_audience
end
def process_audience
accounts_in_audience.each do |account|
# This runs after tags are processed, and those translate into non-silent
# mentions, which take precedence