Module: ResolvesMergeRequests

Extended by:
ActiveSupport::Concern
Includes:
LooksAhead
Included in:
Resolvers::MergeRequestResolver, Resolvers::MergeRequestsResolver
Defined in:
app/graphql/resolvers/concerns/resolves_merge_requests.rb

Overview

Mixin for resolving merge requests. All arguments must be in forms that `MergeRequestsFinder` can handle, so you may need to use aliasing.

Constant Summary

Constants included from LooksAhead

LooksAhead::FEATURE_FLAG

Instance Method Summary collapse

Methods included from LooksAhead

#apply_lookahead, #resolve

Instance Method Details

#early_returnObject


26
27
28
# File 'app/graphql/resolvers/concerns/resolves_merge_requests.rb', line 26

def early_return
  [false, single? ? nil : MergeRequest.none]
end

#ready?(**args) ⇒ Boolean

Returns:

  • (Boolean)

20
21
22
23
24
# File 'app/graphql/resolvers/concerns/resolves_merge_requests.rb', line 20

def ready?(**args)
  return early_return if no_results_possible?(args)

  super
end

#resolve_with_lookahead(**args) ⇒ Object


13
14
15
16
17
18
# File 'app/graphql/resolvers/concerns/resolves_merge_requests.rb', line 13

def resolve_with_lookahead(**args)
  mr_finder = MergeRequestsFinder.new(current_user, args.compact)
  finder = Gitlab::Graphql::Loaders::IssuableLoader.new(project, mr_finder)

  select_result(finder.batching_find_all { |query| apply_lookahead(query) })
end