Skip to content
代码片段 群组 项目
未验证 提交 ac6327b6 编辑于 作者: Smriti Garg's avatar Smriti Garg 提交者: GitLab
浏览文件

Added enforced cursor based keyset

上级 8a918b7f
No related branches found
No related tags found
无相关合并请求
......@@ -389,6 +389,7 @@ For large collections, you should use keyset pagination
### Offset-based pagination
> - The `users` endpoint was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/426547) for offset-based pagination in GitLab 16.5 and is planned for removal in 17.0. This change is a breaking change. Use keyset-based pagination for this endpoint instead.
> - The `users` endpoint enforces keyset-based pagination when the number of requested records is greater than 50,000 in GitLab 17.0.
Sometimes, the returned result spans many pages. When listing resources, you can
pass the following parameters:
......
......@@ -9,7 +9,7 @@ module CursorBasedKeyset
#
# In many cases this could introduce a breaking change
# so enforcement is optional.
ENFORCED_TYPES = [Group].freeze
ENFORCED_TYPES = [Group, User].freeze
def self.available_for_type?(relation)
relation.klass.respond_to?(:supported_keyset_orderings)
......
......@@ -32,16 +32,18 @@ def self.supported_keyset_orderings
subject { described_class.enforced_for_type?(project, relation) }
context 'when relation is Group' do
let(:relation) { Group.all }
it { is_expected.to be true }
where(:relation, :result) do
[
[Group.all, true],
[User.all, true],
[AuditEvent.all, false]
]
end
context 'when relation is AuditEvent' do
let(:relation) { AuditEvent.all }
it { is_expected.to be false }
with_them do
it "returns true only for enforced types" do
expect(subject).to be result
end
end
context 'when relation is Ci::Build' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册