mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Merge commit 'c72ca33fac1ae1518371f5954ae9487692b17709' into glitch-soc/merge-upstream
This commit is contained in:
@@ -58,7 +58,7 @@ class ActivityPub::Activity::Accept < ActivityPub::Activity
|
||||
|
||||
def accept_quote!(quote)
|
||||
approval_uri = value_or_id(first_of_value(@json['result']))
|
||||
return if unsupported_uri_scheme?(approval_uri) || quote.quoted_account != @account || !quote.status.local? || !quote.pending?
|
||||
return if unsupported_uri_scheme?(approval_uri) || non_matching_uri_hosts?(approval_uri, @account.uri) || quote.quoted_account != @account || !quote.status.local? || !quote.pending?
|
||||
|
||||
# NOTE: we are not going through `ActivityPub::VerifyQuoteService` as the `Accept` is as authoritative
|
||||
# as the stamp, but this means we are not checking the stamp, which may lead to inconsistencies
|
||||
|
||||
@@ -48,6 +48,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||
@params = {}
|
||||
@quote = nil
|
||||
@quote_uri = nil
|
||||
@quote_approval_uri = nil
|
||||
|
||||
process_status_params
|
||||
process_tags
|
||||
@@ -229,9 +230,9 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||
@quote_uri = @status_parser.quote_uri
|
||||
return unless @status_parser.quote?
|
||||
|
||||
approval_uri = @status_parser.quote_approval_uri
|
||||
approval_uri = nil if unsupported_uri_scheme?(approval_uri) || TagManager.instance.local_url?(approval_uri)
|
||||
@quote = Quote.new(account: @account, approval_uri: approval_uri, legacy: @status_parser.legacy_quote?, state: @status_parser.deleted_quote? ? :deleted : :pending)
|
||||
@quote_approval_uri = @status_parser.quote_approval_uri
|
||||
@quote_approval_uri = nil if unsupported_uri_scheme?(@quote_approval_uri) || TagManager.instance.local_url?(@quote_approval_uri)
|
||||
@quote = Quote.new(account: @account, approval_uri: nil, legacy: @status_parser.legacy_quote?, state: @status_parser.deleted_quote? ? :deleted : :pending)
|
||||
end
|
||||
|
||||
def process_hashtag(tag)
|
||||
@@ -391,9 +392,9 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||
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])
|
||||
ActivityPub::VerifyQuoteService.new.call(@quote, @quote_approval_uri, 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] })
|
||||
ActivityPub::RefetchAndVerifyQuoteWorker.perform_in(rand(30..600).seconds, @quote.id, @quote_uri, { 'request_id' => @options[:request_id], 'approval_uri' => @quote_approval_uri })
|
||||
end
|
||||
|
||||
def conversation_from_uri(uri)
|
||||
|
||||
Reference in New Issue
Block a user