Fix owned account notes not being deleted when an account is deleted (#16579)
* Add account_notes relationship * Add tests * Fix owned account notes not being deleted when an account is deleted * Add post-migration to clean up orphaned account notes
This commit is contained in:
parent
818e0b314f
commit
763ab0c7eb
5 changed files with 31 additions and 2 deletions
|
@ -21,6 +21,8 @@ RSpec.describe DeleteAccountService, type: :service do
|
|||
let!(:favourite_notification) { Fabricate(:notification, account: local_follower, activity: favourite, type: :favourite) }
|
||||
let!(:follow_notification) { Fabricate(:notification, account: local_follower, activity: active_relationship, type: :follow) }
|
||||
|
||||
let!(:account_note) { Fabricate(:account_note, account: account) }
|
||||
|
||||
subject do
|
||||
-> { described_class.new.call(account) }
|
||||
end
|
||||
|
@ -35,8 +37,9 @@ RSpec.describe DeleteAccountService, type: :service do
|
|||
account.active_relationships,
|
||||
account.passive_relationships,
|
||||
account.polls,
|
||||
account.account_notes,
|
||||
].map(&:count)
|
||||
}.from([2, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0])
|
||||
}.from([2, 1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0, 0])
|
||||
end
|
||||
|
||||
it 'deletes associated target records' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue