Merge tag 'v4.4.3' into chinwag-next

This commit is contained in:
Mike Barnes 2025-09-14 17:27:33 +10:00
commit 6ca47a7476
229 changed files with 4207 additions and 1590 deletions

View file

@ -17,9 +17,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity? || reject_pattern?
with_redis_lock("create:#{object_uri}") do
return if delete_arrived_first?(object_uri) || poll_vote?
Status.uncached do
return if delete_arrived_first?(object_uri) || poll_vote?
@status = find_existing_status
@status = find_existing_status
end
if @status.nil?
process_status
@ -64,6 +66,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
resolve_thread(@status)
resolve_unresolved_mentions(@status)
fetch_replies(@status)
fetch_and_verify_quote
distribute
forward_for_reply
end
@ -204,11 +207,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
@quote.status = status
@quote.save
embedded_quote = safe_prefetched_embed(@account, @status_parser.quoted_object, @json['context'])
ActivityPub::VerifyQuoteService.new.call(@quote, fetchable_quoted_uri: @quote_uri, prefetched_quoted_object: embedded_quote, request_id: @options[:request_id])
rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS
ActivityPub::RefetchAndVerifyQuoteWorker.perform_in(rand(30..600).seconds, @quote.id, @quote_uri, { 'request_id' => @options[:request_id] })
end
def process_tags
@ -378,6 +376,15 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
Rails.logger.warn "Error fetching replies: #{e}"
end
def fetch_and_verify_quote
return if @quote.nil?
embedded_quote = safe_prefetched_embed(@account, @status_parser.quoted_object, @json['context'])
ActivityPub::VerifyQuoteService.new.call(@quote, fetchable_quoted_uri: @quote_uri, prefetched_quoted_object: embedded_quote, request_id: @options[:request_id], depth: @options[:depth])
rescue Mastodon::RecursionLimitExceededError, Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS
ActivityPub::RefetchAndVerifyQuoteWorker.perform_in(rand(30..600).seconds, @quote.id, @quote_uri, { 'request_id' => @options[:request_id] })
end
def conversation_from_uri(uri)
return nil if uri.nil?
return Conversation.find_by(id: OStatus::TagManager.instance.unique_tag_to_local_id(uri, 'Conversation')) if OStatus::TagManager.instance.local_id?(uri)

View file

@ -152,9 +152,6 @@ class ActivityPub::Parser::StatusParser
# Remove the special-meaning actor URI
allowed_actors.delete(@options[:actor_uri])
# Tagged users are always allowed, so remove them
allowed_actors -= as_array(@object['tag']).filter_map { |tag| tag['href'] if equals_or_includes?(tag['type'], 'Mention') }
# Any unrecognized actor is marked as unknown
flags |= Status::QUOTE_APPROVAL_POLICY_FLAGS[:unknown] unless allowed_actors.empty?