Class: Resolvers::WorkItemReferencesResolver

Inherits:
BaseResolver
  • Object
show all
Includes:
Gitlab::Graphql::Authorize::AuthorizeResource, WorkItems::LookAheadPreloads
Defined in:
app/graphql/resolvers/work_item_references_resolver.rb

Constant Summary collapse

REFERENCES_LIMIT =
10

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #raise_resource_not_available_error!

Methods inherited from BaseResolver

as_single, authorization, authorized?, before_connection_authorization, before_connection_authorization_block, calculate_ext_conn_complexity, calls_gitaly!, calls_gitaly?, complexity, complexity_multiplier, #current_user, last, #object, #offset_pagination, requires_argument!, requires_argument?, resolver_complexity, #select_result, single, #single?, single_definition_blocks, singular_type, when_single

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Instance Method Details

#ready?(**args) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/graphql/resolvers/work_item_references_resolver.rb', line 21

def ready?(**args)
  if args[:refs].size > REFERENCES_LIMIT
    raise Gitlab::Graphql::Errors::ArgumentError,
      format(
        _('Number of references exceeds the limit. ' \
          'Please provide no more than %{refs_limit} references at the same time.'),
        refs_limit: REFERENCES_LIMIT
      )
  end

  super
end

#resolve_with_lookahead(context_namespace_path: nil, refs: []) ⇒ Object



34
35
36
37
38
39
40
# File 'app/graphql/resolvers/work_item_references_resolver.rb', line 34

def resolve_with_lookahead(context_namespace_path: nil, refs: [])
  return WorkItem.none if refs.empty?

  @container = authorized_find!(context_namespace_path)

  apply_lookahead(find_work_items(refs))
end