Commit 39e5b880 authored by Manoj M J's avatar Manoj M J

Use Keyset pagination for Groups API by default

This MR introduces Keyset pagination
for Groups API, by default when the user
is unauthenticated

Changelog: added
parent 8457ee85
---
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