Fetch unknown collection when handling FeatureRequest activity (#38413)

This commit is contained in:
David Roetzel
2026-03-26 14:30:27 +01:00
committed by GitHub
parent 35c30dfc6e
commit abd29109c5
2 changed files with 35 additions and 1 deletions

View File

@@ -52,5 +52,28 @@ RSpec.describe ActivityPub::Activity::FeatureRequest do
end, recipient.id, sender.inbox_url)
end
end
context 'when the collection is not yet known' do
let(:discoverable) { true }
let(:collection) { instance_double(Collection, uri: 'https://example.com/collections/1') }
let(:stubbed_service) do
service = instance_double(ActivityPub::FetchRemoteFeaturedCollectionService)
allow(service).to receive(:call) do
Fabricate(:remote_collection, account: sender, uri: collection.uri)
end
service
end
before do
allow(ActivityPub::FetchRemoteFeaturedCollectionService).to receive(:new).and_return(stubbed_service)
end
it 'fetches the collection before handling the request' do
subject.perform
expect(ActivityPub::DeliveryWorker).to have_enqueued_sidekiq_job
expect(stubbed_service).to have_received(:call)
end
end
end
end