diff --git a/app/javascript/mastodon/components/status_quoted.tsx b/app/javascript/mastodon/components/status_quoted.tsx index d66d70d86ea..ed869a79ed0 100644 --- a/app/javascript/mastodon/components/status_quoted.tsx +++ b/app/javascript/mastodon/components/status_quoted.tsx @@ -275,6 +275,41 @@ export const QuotedStatus: React.FC = ({ ); + } else if (quoteState === 'pending_delayed') { + quoteError = ( + <> + + +

+ +

+
+ + ); + } else if (quoteState === 'verification_failed') { + quoteError = ( + <> + + +

+ +

+
+ + ); + } else if (quoteState === 'revoked') { quoteError = ( @options[:request_id], 'approval_uri' => @quote_approval_uri }) end diff --git a/app/models/quote.rb b/app/models/quote.rb index 7c453a097e5..5222551afa9 100644 --- a/app/models/quote.rb +++ b/app/models/quote.rb @@ -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 diff --git a/app/workers/activitypub/refetch_and_verify_quote_worker.rb b/app/workers/activitypub/refetch_and_verify_quote_worker.rb index 762d55e1bee..40f30a35896 100644 --- a/app/workers/activitypub/refetch_and_verify_quote_worker.rb +++ b/app/workers/activitypub/refetch_and_verify_quote_worker.rb @@ -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'])