2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
2023-01-13 00:05:48 +05:30
|
|
|
class IssuesResolver < Issues::BaseResolver
|
|
|
|
prepend ::Issues::LookAheadPreloads
|
|
|
|
include ::Issues::SortArguments
|
|
|
|
|
|
|
|
argument :state, Types::IssuableStateEnum,
|
|
|
|
required: false,
|
|
|
|
description: 'Current state of this issue.'
|
|
|
|
|
|
|
|
# see app/graphql/types/issue_connection.rb
|
|
|
|
type 'Types::IssueConnection', null: true
|
|
|
|
|
|
|
|
def resolve_with_lookahead(**args)
|
|
|
|
return unless Feature.enabled?(:root_level_issues_query)
|
|
|
|
|
|
|
|
issues = apply_lookahead(
|
|
|
|
IssuesFinder.new(current_user, prepare_finder_params(args)).execute
|
|
|
|
)
|
|
|
|
|
|
|
|
if non_stable_cursor_sort?(args[:sort])
|
|
|
|
# Certain complex sorts are not supported by the stable cursor pagination yet.
|
|
|
|
# In these cases, we use offset pagination, so we return the correct connection.
|
|
|
|
offset_pagination(issues)
|
|
|
|
else
|
|
|
|
issues
|
|
|
|
end
|
|
|
|
end
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|