Remove collections when user is suspended (#39809)

This commit is contained in:
David Roetzel 2026-07-15 13:04:10 +02:00 committed by Tarrien
parent 32cbeb3952
commit 2f9f21bce0
2 changed files with 5 additions and 0 deletions

View File

@ -10,6 +10,7 @@ class DeleteAccountService < BaseService
aliases aliases
block_relationships block_relationships
blocked_by_relationships blocked_by_relationships
collections
conversation_mutes conversation_mutes
conversations conversations
custom_filters custom_filters

View File

@ -47,6 +47,7 @@ RSpec.describe DeleteAccountService do
expect { poll.reload }.to raise_error(ActiveRecord::RecordNotFound) expect { poll.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect { poll_vote.reload }.to raise_error(ActiveRecord::RecordNotFound) expect { poll_vote.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect { account_note.reload }.to raise_error(ActiveRecord::RecordNotFound) expect { account_note.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect { collection.reload }.to raise_error(ActiveRecord::RecordNotFound)
end end
def expect_deletion_of_associated_target_records def expect_deletion_of_associated_target_records
@ -74,6 +75,7 @@ RSpec.describe DeleteAccountService do
it_behaves_like 'common behavior' do it_behaves_like 'common behavior' do
let(:account) { Fabricate(:account) } let(:account) { Fabricate(:account) }
let(:local_follower) { Fabricate(:account) } let(:local_follower) { Fabricate(:account) }
let!(:collection) { Fabricate(:collection, account:) } # rubocop:disable RSpec/LetSetup
it 'sends a delete actor activity to all known inboxes' do it 'sends a delete actor activity to all known inboxes' do
subject subject
@ -92,6 +94,8 @@ RSpec.describe DeleteAccountService do
let(:account) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', protocol: :activitypub, domain: 'bob.com') } let(:account) { Fabricate(:account, inbox_url: 'https://bob.com/inbox', protocol: :activitypub, domain: 'bob.com') }
let(:local_follower) { Fabricate(:account) } let(:local_follower) { Fabricate(:account) }
let!(:collection) { Fabricate(:remote_collection, account:) } # rubocop:disable RSpec/LetSetup
it 'sends expected activities to followed and follower inboxes' do it 'sends expected activities to followed and follower inboxes' do
subject subject