mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Handle Delete of a FeatureAuthorization (#38292)
This commit is contained in:
@@ -119,5 +119,28 @@ RSpec.describe ActivityPub::Activity::Delete do
|
||||
.to change { quote.reload.state }.to('revoked')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a FeatureAuthorization', feature: :collections_federation do
|
||||
let(:recipient) { Fabricate(:account) }
|
||||
let(:approval_uri) { 'https://example.com/authorizations/1' }
|
||||
let(:collection) { Fabricate(:collection, account: recipient) }
|
||||
let!(:collection_item) { Fabricate(:collection_item, collection:, account: sender, state: :accepted, approval_uri:) }
|
||||
let(:json) do
|
||||
{
|
||||
'id' => 'https://example.com/accepts/1',
|
||||
'type' => 'Delete',
|
||||
'actor' => sender.uri,
|
||||
'to' => ActivityPub::TagManager.instance.uri_for(recipient),
|
||||
'object' => approval_uri,
|
||||
}
|
||||
end
|
||||
|
||||
it 'revokes the collection item and federates a `Delete` activity' do
|
||||
subject.perform
|
||||
|
||||
expect(collection_item.reload).to be_revoked
|
||||
expect(ActivityPub::AccountRawDistributionWorker).to have_enqueued_sidekiq_job
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,5 +18,13 @@ RSpec.describe DeleteCollectionItemService do
|
||||
|
||||
expect(ActivityPub::AccountRawDistributionWorker).to have_enqueued_sidekiq_job
|
||||
end
|
||||
|
||||
context 'when `revoke` is set to true' do
|
||||
it 'revokes the collection item' do
|
||||
subject.call(collection_item, revoke: true)
|
||||
|
||||
expect(collection_item.reload).to be_revoked
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user