From 0e249cba4b4d010c56bb5a1ee7e6d9a9d5929e59 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 31 Jul 2025 16:23:36 +0200 Subject: [PATCH] Revoke quote posts when those get deleted (#35614) --- app/services/activitypub/process_status_update_service.rb | 2 ++ app/services/remove_status_service.rb | 3 +++ 2 files changed, 5 insertions(+) diff --git a/app/services/activitypub/process_status_update_service.rb b/app/services/activitypub/process_status_update_service.rb index 9c96c51851f..064ccf0f337 100644 --- a/app/services/activitypub/process_status_update_service.rb +++ b/app/services/activitypub/process_status_update_service.rb @@ -298,6 +298,8 @@ class ActivityPub::ProcessStatusUpdateService < BaseService if @status.quote.present? # If the quoted post has changed, discard the old object and create a new one if @status.quote.quoted_status.present? && ActivityPub::TagManager.instance.uri_for(@status.quote.quoted_status) != quote_uri + # Revoke the quote while we get a chance… maybe this should be a `before_destroy` hook? + RevokeQuoteService.new.call(@status.quote) if @status.quote.quoted_account&.local? && @status.quote.accepted? @status.quote.destroy quote = Quote.create(status: @status, approval_uri: approval_uri, legacy: @status_parser.legacy_quote?) @quote_changed = true diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 2adb8c1edbe..f61cb632b23 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -47,6 +47,9 @@ class RemoveStatusService < BaseService remove_media end + # Revoke the quote while we get a chance… maybe this should be a `before_destroy` hook? + RevokeQuoteService.new.call(@status.quote) if @status.quote&.quoted_account&.local? && @status.quote&.accepted? + @status.destroy! if permanently? end end