Skip to content
Snippets Groups Projects
Commit f3e3693c authored by Brett Walker's avatar Brett Walker
Browse files

Removal of to_graphql only possible on this branch

to_graphql is now deprecated, and most are being
removed from the main code tree.  However those
that can’t are removed here.
parent c4bb8684
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !27536. Comments created here will be created in the context of that merge request.
...@@ -150,10 +150,9 @@ def field_resolver_complexity ...@@ -150,10 +150,9 @@ def field_resolver_complexity
def connection_complexity_multiplier(ctx, args) def connection_complexity_multiplier(ctx, args)
# Resolvers may add extra complexity depending on number of items being loaded. # Resolvers may add extra complexity depending on number of items being loaded.
field_defn = to_graphql return 0 unless connection?
return 0 unless field_defn.connection?
page_size = field_defn.connection_max_page_size || ctx.schema.default_max_page_size page_size = max_page_size || ctx.schema.default_max_page_size
limit_value = [args[:first], args[:last], page_size].compact.min limit_value = [args[:first], args[:last], page_size].compact.min
multiplier = resolver&.try(:complexity_multiplier, args).to_f multiplier = resolver&.try(:complexity_multiplier, args).to_f
limit_value * multiplier limit_value * multiplier
......
...@@ -154,7 +154,7 @@ def fresh_object_type(name = 'Object') ...@@ -154,7 +154,7 @@ def fresh_object_type(name = 'Object')
def resolver_instance(resolver_class, obj: nil, ctx: {}, field: nil, schema: GitlabSchema, subscription_update: false) def resolver_instance(resolver_class, obj: nil, ctx: {}, field: nil, schema: GitlabSchema, subscription_update: false)
if ctx.is_a?(Hash) if ctx.is_a?(Hash)
q = double('Query', schema: schema, subscription_update?: subscription_update) q = double('Query', schema: schema, subscription_update?: subscription_update, warden: GraphQL::Schema::Warden::PassThruWarden)
ctx = GraphQL::Query::Context.new(query: q, object: obj, values: ctx) ctx = GraphQL::Query::Context.new(query: q, object: obj, values: ctx)
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment