mirror of
https://github.com/mastodon/mastodon.git
synced 2026-09-13 13:58:53 -05:00
Fix account deletion not deleting generated annual reports (#40394)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user