Commit 56a2c536 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '339831-feature-flag-rollout-of-keyset_pagination_for_groups_api' into 'master'

Enable by default: Keyset pagination for `GET /groups` API endpoint for unauthenticated users

See merge request gitlab-org/gitlab!75078
parents 45585d2b 39e5b880
---
name: keyset_pagination_for_groups_api
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68346
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339831
milestone: '14.3'
type: development
group: group::access
default_enabled: false
...@@ -109,7 +109,7 @@ module API ...@@ -109,7 +109,7 @@ module API
end end
def present_groups_with_pagination_strategies(params, groups) def present_groups_with_pagination_strategies(params, groups)
return present_groups(params, groups) if current_user.present? || Feature.disabled?(:keyset_pagination_for_groups_api) return present_groups(params, groups) if current_user.present?
options = { options = {
with: Entities::Group, with: Entities::Group,
......
...@@ -174,18 +174,6 @@ RSpec.describe API::Groups do ...@@ -174,18 +174,6 @@ RSpec.describe API::Groups do
'Remaining records can be retrieved using keyset pagination.' 'Remaining records can be retrieved using keyset pagination.'
) )
end end
context 'when the feature flag `keyset_pagination_for_groups_api` is disabled' do
before do
stub_feature_flags(keyset_pagination_for_groups_api: false)
end
it 'returns successful response' do
get api('/groups'), params: { page: 3000, per_page: 25 }
expect(response).to have_gitlab_http_status(:ok)
end
end
end end
context 'on making requests below the allowed offset pagination threshold' do context 'on making requests below the allowed offset pagination threshold' do
...@@ -247,24 +235,6 @@ RSpec.describe API::Groups do ...@@ -247,24 +235,6 @@ RSpec.describe API::Groups do
expect(records.size).to eq(1) expect(records.size).to eq(1)
expect(records.first['id']).to eq(group_2.id) expect(records.first['id']).to eq(group_2.id)
end end
context 'when the feature flag `keyset_pagination_for_groups_api` is disabled' do
before do
stub_feature_flags(keyset_pagination_for_groups_api: false)
end
it 'ignores the keyset pagination params and performs offset pagination' do
get api('/groups'), params: { pagination: 'keyset', per_page: 1 }
expect(response).to have_gitlab_http_status(:ok)
records = json_response
expect(records.size).to eq(1)
expect(records.first['id']).to eq(group_1.id)
params_for_next_page = params_for_next_page(response)
expect(params_for_next_page).not_to include('cursor')
end
end
end end
context 'on making requests with unsupported ordering structure' do context 'on making requests with unsupported ordering structure' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment