mirror of
https://github.com/mastodon/mastodon.git
synced 2026-08-22 03:55:09 -05:00
Merge 6c78789e82 into 20c105c194
This commit is contained in:
@@ -275,6 +275,41 @@ export const QuotedStatus: React.FC<QuotedStatusProps> = ({
|
||||
</LearnMoreLink>
|
||||
</>
|
||||
);
|
||||
} else if (quoteState === 'pending_delayed') {
|
||||
quoteError = (
|
||||
<>
|
||||
<FormattedMessage
|
||||
id='status.quote_error.pending_delayed'
|
||||
defaultMessage='Post pending - Delayed'
|
||||
/>
|
||||
<LearnMoreLink>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id='status.quote_error.pending_delayed_popout.body'
|
||||
defaultMessage="We're retrying verification of this quote in the background. This usually resolves on its own."
|
||||
/>
|
||||
</p>
|
||||
</LearnMoreLink>
|
||||
</>
|
||||
);
|
||||
} else if (quoteState === 'verification_failed') {
|
||||
quoteError = (
|
||||
<>
|
||||
<FormattedMessage
|
||||
id='status.quote_error.verification_failed'
|
||||
defaultMessage='Quote verification failed'
|
||||
/>
|
||||
<LearnMoreLink>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id='status.quote_error.verification_failed_popout.body'
|
||||
defaultMessage="We're failed to verify this quote. This quote is unlikely to be shown due to this failure."
|
||||
/>
|
||||
</p>
|
||||
</LearnMoreLink>
|
||||
</>
|
||||
);
|
||||
|
||||
} else if (quoteState === 'revoked') {
|
||||
quoteError = (
|
||||
<FormattedMessage
|
||||
|
||||
@@ -1280,7 +1280,11 @@
|
||||
"status.quote_error.not_available": "Post unavailable",
|
||||
"status.quote_error.pending_approval": "Post pending",
|
||||
"status.quote_error.pending_approval_popout.body": "On Mastodon, you can control whether someone can quote you. This post is pending while we're getting the original author's approval.",
|
||||
"status.quote_error.pending_delayed": "Post pending - Delayed",
|
||||
"status.quote_error.pending_delayed_popout.body": "We're retrying verification of this quote in the background. This usually resolves on its own.",
|
||||
"status.quote_error.revoked": "Post removed by author",
|
||||
"status.quote_error.verification_failed": "Quote verification failed",
|
||||
"status.quote_error.verification_failed_popout.body": "We're failed to verify this quote. This quote is unlikely to be shown due to this failure.",
|
||||
"status.quote_followers_only": "Only followers can quote this post",
|
||||
"status.quote_manual_review": "Author will manually review",
|
||||
"status.quote_noun": "Quote",
|
||||
|
||||
@@ -414,6 +414,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||
embedded_quote = safe_prefetched_embed(@account, @status_parser.quoted_object, @json['context'])
|
||||
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
|
||||
@quote.update!(state: :pending_delayed)
|
||||
ActivityPub::RefetchAndVerifyQuoteWorker.perform_in(rand(PROCESSING_DELAY), @quote.id, @quote_uri, { 'request_id' => @options[:request_id], 'approval_uri' => @quote_approval_uri })
|
||||
end
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class Quote < ApplicationRecord
|
||||
REFRESH_DEADLINE = 6.hours
|
||||
|
||||
enum :state,
|
||||
{ pending: 0, accepted: 1, rejected: 2, revoked: 3, deleted: 4 },
|
||||
{ pending: 0, accepted: 1, rejected: 2, revoked: 3, deleted: 4, pending_delayed: 5, verification_failed: 6 },
|
||||
validate: true
|
||||
|
||||
belongs_to :status
|
||||
|
||||
@@ -7,6 +7,16 @@ class ActivityPub::RefetchAndVerifyQuoteWorker
|
||||
|
||||
sidekiq_options queue: 'pull', retry: 5
|
||||
|
||||
sidekiq_retries_exhausted do |msg|
|
||||
quote_id = msg['args'].first
|
||||
|
||||
ActiveRecord::Base.connection_pool.with_connection do
|
||||
Quote.find(quote_id).update!(state: :verification_failed)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def perform(quote_id, quoted_uri, options = {})
|
||||
quote = Quote.find(quote_id)
|
||||
ActivityPub::VerifyQuoteService.new.call(quote, options['approval_uri'], fetchable_quoted_uri: quoted_uri, request_id: options['request_id'])
|
||||
|
||||
Reference in New Issue
Block a user