2019-12-06 13:07:44 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Pagination
|
|
|
|
module Keyset
|
2020-05-05 17:09:42 -04:00
|
|
|
SUPPORTED_TYPES = [
|
|
|
|
Project
|
|
|
|
].freeze
|
|
|
|
|
|
|
|
def self.available_for_type?(relation)
|
|
|
|
SUPPORTED_TYPES.include?(relation.klass)
|
|
|
|
end
|
|
|
|
|
2019-12-06 13:07:44 -05:00
|
|
|
def self.available?(request_context, relation)
|
|
|
|
order_by = request_context.page.order_by
|
|
|
|
|
2020-05-05 17:09:42 -04:00
|
|
|
return false unless available_for_type?(relation)
|
2019-12-06 13:07:44 -05:00
|
|
|
return false unless order_by.size == 1 && order_by[:id]
|
|
|
|
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|