Federate local collection item revocation (#40930)

This commit is contained in:
David Roetzel authored and Claire committed 2026-10-28 18:54:14 +01:00
1 parent 20c0ce956d
commit 88683ac613
2 files changed
+5 -3

No files matched your search

@@ -10,13 +10,13 @@ class RevokeCollectionItemService < BaseService
@collection_item.revoke!
distribute_stamp_deletion! if @collection_item.remote?
distribute_stamp_deletion!
end
private
def distribute_stamp_deletion!
ActivityPub::DeliveryWorker.perform_async(signed_activity_json, @account.id, @collection.account.inbox_url)
ActivityPub::DeliveryWorker.perform_async(signed_activity_json, @account.id, @collection.account.inbox_url) if @collection_item.remote?
ActivityPub::CollectionRawDistributionWorker.perform_async(signed_activity_json, @collection.id)
end
@@ -10,6 +10,8 @@ RSpec.describe RevokeCollectionItemService do
it 'revokes the collection item and sends a Delete activity' do
expect { subject.call(collection_item) }
.to change { collection_item.reload.state }.from('accepted').to('revoked')
expect(ActivityPub::CollectionRawDistributionWorker).to have_enqueued_sidekiq_job
end
context 'when the collection is remote' do
@@ -17,7 +19,7 @@ RSpec.describe RevokeCollectionItemService do
let(:collection) { Fabricate(:remote_collection, account:) }
let(:collection_item) { Fabricate(:collection_item, collection:, uri: 'https://example.com') }
it 'federates a `Delete` activity' do
it 'federates a `Delete` activity to collection owner as well' do
subject.call(collection_item)
expect(ActivityPub::DeliveryWorker).to have_enqueued_sidekiq_job.with(instance_of(String), collection_item.account_id, 'https://example.com/actor/1/inbox')