Handle Update of a FeaturedCollection (#38337)

This commit is contained in:
David Roetzel
2026-03-23 16:57:02 +01:00
committed by GitHub
parent 5a7c565396
commit e4e584a99e
2 changed files with 48 additions and 0 deletions

View File

@@ -256,5 +256,45 @@ RSpec.describe ActivityPub::Activity::Update do
end
end
end
context 'with a `FeaturedCollection` object', feature: :collections_federation do
let(:collection) { Fabricate(:remote_collection, account: sender, name: 'old name', discoverable: false) }
let(:featured_collection_json) do
{
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => collection.uri,
'type' => 'FeaturedCollection',
'attributedTo' => sender.uri,
'name' => 'Cool people',
'summary' => 'People you should follow.',
'totalItems' => 0,
'sensitive' => false,
'discoverable' => true,
'published' => '2026-03-09T15:19:25Z',
'updated' => Time.zone.now.iso8601,
}
end
let(:json) do
{
'@context' => 'https://www.w3.org/ns/activitystreams',
'type' => 'Update',
'actor' => sender.uri,
'object' => featured_collection_json,
}
end
let(:stubbed_service) do
instance_double(ActivityPub::ProcessFeaturedCollectionService, call: true)
end
before do
allow(ActivityPub::ProcessFeaturedCollectionService).to receive(:new).and_return(stubbed_service)
end
it 'updates the collection' do
subject.perform
expect(stubbed_service).to have_received(:call).with(sender, featured_collection_json)
end
end
end
end