2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Pagination
|
|
|
|
module Keyset
|
2023-06-20 00:43:36 +05:30
|
|
|
SUPPORTED_TYPES = %w[
|
2020-05-24 23:13:21 +05:30
|
|
|
Project
|
|
|
|
].freeze
|
|
|
|
|
|
|
|
def self.available_for_type?(relation)
|
2023-06-20 00:43:36 +05:30
|
|
|
SUPPORTED_TYPES.include?(relation.klass.to_s)
|
2020-05-24 23:13:21 +05:30
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
def self.available?(request_context, relation)
|
|
|
|
order_by = request_context.page.order_by
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
return false unless available_for_type?(relation)
|
2020-01-01 13:55:28 +05:30
|
|
|
return false unless order_by.size == 1 && order_by[:id]
|
|
|
|
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|