Destroy dependent notifications of a collection (#39429)

This commit is contained in:
David Roetzel authored and Claire committed 2026-06-15 17:01:10 +02:00
1 parent fcf222246a
commit dc53b0e077
3 files changed
+17 -1

No files matched your search

+15
View File
@@ -221,4 +221,19 @@ RSpec.describe Collection do
expect(subject.to_log_permalink).to eq ActivityPub::TagManager.instance.uri_for(subject)
end
end
describe '#destroy' do
let(:collection) { Fabricate(:collection) }
before do
Fabricate(:notification, activity: collection, type: :added_to_collection)
Fabricate(:notification, activity: collection, type: :collection_update)
end
it 'removes the collection and all notifications that reference it' do
expect { collection.destroy }
.to change(described_class, :count).by(-1)
.and change(Notification, :count).by(-2)
end
end
end