Add service to revoke inclusion in a Collection (#38026)

This commit is contained in:
David Roetzel
2026-03-02 11:16:41 +01:00
committed by GitHub
parent 6ab24de659
commit 2f65701920
5 changed files with 105 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe RevokeCollectionItemService do
subject { described_class.new }
let(:collection_item) { Fabricate(:collection_item) }
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')
end
context 'when the collection is remote', feature: :collections_federation do
let(:collection) { Fabricate(:remote_collection) }
let(:collection_item) { Fabricate(:collection_item, collection:, uri: 'https://example.com') }
it 'federates a `Delete` activity' do
subject.call(collection_item)
expect(ActivityPub::AccountRawDistributionWorker).to have_enqueued_sidekiq_job
end
end
end