Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-09 06:10:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-09 06:10:10 +0300
commit53f7c2edf478dac9e6b8e52c4b9a59c53659eb31 (patch)
tree095dd8a89f604956f5ff0ddf6e0b0cd0e0274a27 /app
parent6ec1ac0d653ff7436487e41019175d5413ee22c3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/graphql/gitlab_schema.rb24
-rw-r--r--app/graphql/types/query_type.rb2
2 files changed, 8 insertions, 18 deletions
diff --git a/app/graphql/gitlab_schema.rb b/app/graphql/gitlab_schema.rb
index 8e95bd501ff..38ba1611c48 100644
--- a/app/graphql/gitlab_schema.rb
+++ b/app/graphql/gitlab_schema.rb
@@ -3,9 +3,9 @@
class GitlabSchema < GraphQL::Schema
# Currently an IntrospectionQuery has a complexity of 179.
# These values will evolve over time.
- DEFAULT_MAX_COMPLEXITY = 200
- AUTHENTICATED_COMPLEXITY = 250
- ADMIN_COMPLEXITY = 300
+ DEFAULT_MAX_COMPLEXITY = 200
+ AUTHENTICATED_MAX_COMPLEXITY = 250
+ ADMIN_MAX_COMPLEXITY = 300
DEFAULT_MAX_DEPTH = 15
AUTHENTICATED_MAX_DEPTH = 20
@@ -20,9 +20,6 @@ class GitlabSchema < GraphQL::Schema
query_analyzer Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer.new
query_analyzer Gitlab::Graphql::QueryAnalyzers::RecursionAnalyzer.new
- max_complexity DEFAULT_MAX_COMPLEXITY
- max_depth DEFAULT_MAX_DEPTH
-
query Types::QueryType
mutation Types::MutationType
subscription Types::SubscriptionType
@@ -36,20 +33,13 @@ class GitlabSchema < GraphQL::Schema
kwargs[:max_complexity] ||= max_query_complexity(kwargs[:context]) unless kwargs.key?(:max_complexity)
queries.each do |query|
- query[:max_complexity] ||= max_query_complexity(kwargs[:context]) unless query.key?(:max_complexity)
- query[:max_depth] = max_query_depth(kwargs[:context])
+ query[:max_complexity] ||= max_query_complexity(query[:context]) unless query.key?(:max_complexity)
+ query[:max_depth] = max_query_depth(query[:context]) unless query.key?(:max_depth)
end
super(queries, **kwargs)
end
- def execute(query_str = nil, **kwargs)
- kwargs[:max_complexity] ||= max_query_complexity(kwargs[:context])
- kwargs[:max_depth] ||= max_query_depth(kwargs[:context])
-
- super(query_str, **kwargs)
- end
-
def get_type(type_name)
type_name = Gitlab::GlobalId::Deprecations.apply_to_graphql_name(type_name)
@@ -142,9 +132,9 @@ class GitlabSchema < GraphQL::Schema
current_user = ctx&.fetch(:current_user, nil)
if current_user&.admin
- ADMIN_COMPLEXITY
+ ADMIN_MAX_COMPLEXITY
elsif current_user
- AUTHENTICATED_COMPLEXITY
+ AUTHENTICATED_MAX_COMPLEXITY
else
DEFAULT_MAX_COMPLEXITY
end
diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb
index d2c67aea95c..f01a23984e7 100644
--- a/app/graphql/types/query_type.rb
+++ b/app/graphql/types/query_type.rb
@@ -129,7 +129,7 @@ module Types
description: "Find runners visible to the current user.",
feature_flag: :runner_graphql_query
- field :ci_config, resolver: Resolvers::Ci::ConfigResolver, complexity: 126 # AUTHENTICATED_COMPLEXITY / 2 + 1
+ field :ci_config, resolver: Resolvers::Ci::ConfigResolver, complexity: 126 # AUTHENTICATED_MAX_COMPLEXITY / 2 + 1
def design_management
DesignManagementObject.new(nil)