Do not return undiscoverable collections (#37560)

This commit is contained in:
David Roetzel authored and GitHub committed 2026-01-21 12:30:07 +00:00
1 parent e7c6600d83
commit 783504f36a
3 files changed
+28

No files matched your search

@@ -55,6 +55,32 @@ RSpec.describe 'Api::V1Alpha::Collections', feature: :collections do
)
end
end
context 'when some collections are not discoverable' do
before do
Fabricate(:collection, account:, discoverable: false)
end
context 'when requesting user is a third party' do
it 'hides the collections that are not discoverable' do
subject
expect(response).to have_http_status(200)
expect(response.parsed_body.size).to eq 3
end
end
context 'when requesting user owns the collection' do
let(:account) { user.account }
it 'returns all collections, including the ones that are not discoverable' do
subject
expect(response).to have_http_status(200)
expect(response.parsed_body.size).to eq 4
end
end
end
end
describe 'GET /api/v1_alpha/collections/:id' do