Fix account deletion not deleting generated annual reports (#40394)

This commit is contained in:
Claire
2026-09-07 09:51:46 +00:00
committed by GitHub
parent baab7b8768
commit b9dec6c2fb
3 changed files with 5 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ module Account::Associations
has_many :statuses
has_many :keypairs
has_many :email_subscriptions
has_many :generated_annual_reports
has_one :deletion_request, class_name: 'AccountDeletionRequest'
has_one :follow_recommendation_suppression

View File

@@ -28,6 +28,7 @@ class DeleteAccountService < BaseService
scheduled_statuses
status_pins
tag_follows
generated_annual_reports
).freeze
# The following associations have no important side-effects
@@ -53,6 +54,7 @@ class DeleteAccountService < BaseService
scheduled_statuses
status_pins
tag_follows
generated_annual_reports
).freeze
ASSOCIATIONS_ON_DESTROY = %w(

View File

@@ -26,6 +26,7 @@ RSpec.describe DeleteAccountService do
let!(:follow_notification) { Fabricate(:notification, account: local_follower, activity: active_relationship, type: :follow) }
let!(:account_note) { Fabricate(:account_note, account: account) }
let!(:generated_annual_report) { Fabricate(:generated_annual_report, account: account) }
it 'deletes associated owned and target records and target notifications' do
subject
@@ -48,6 +49,7 @@ RSpec.describe DeleteAccountService do
expect { poll_vote.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect { account_note.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect { collection.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect { generated_annual_report.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
def expect_deletion_of_associated_target_records