Federate Remove when collection is deleted (#37741)
This commit is contained in:
1 parent
ffb84ea79d
commit
9cd94168b3
5 files changed
+90
-1
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::RemoveFeaturedCollectionSerializer do
|
||||
subject { serialized_record_json(object, described_class, adapter: ActivityPub::Adapter) }
|
||||
|
||||
let(:tag_manager) { ActivityPub::TagManager.instance }
|
||||
let(:object) { Fabricate(:collection) }
|
||||
|
||||
it 'serializes to the expected json' do
|
||||
expect(subject).to include({
|
||||
'type' => 'Remove',
|
||||
'actor' => tag_manager.uri_for(object.account),
|
||||
'target' => a_string_matching(%r{/featured_collections$}),
|
||||
'object' => tag_manager.uri_for(object),
|
||||
})
|
||||
|
||||
expect(subject).to_not have_key('id')
|
||||
expect(subject).to_not have_key('published')
|
||||
expect(subject).to_not have_key('to')
|
||||
expect(subject).to_not have_key('cc')
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DeleteCollectionService do
|
||||
subject { described_class.new }
|
||||
|
||||
let!(:collection) { Fabricate(:collection) }
|
||||
|
||||
describe '#call' do
|
||||
it 'destroys the collection' do
|
||||
expect { subject.call(collection) }.to change(Collection, :count).by(-1)
|
||||
end
|
||||
|
||||
it 'federates a `Remove` activity', feature: :collections_federation do
|
||||
subject.call(collection)
|
||||
|
||||
expect(ActivityPub::AccountRawDistributionWorker).to have_enqueued_sidekiq_job
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user