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
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/gitlab_schema.rb')
-rw-r--r--app/graphql/gitlab_schema.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/graphql/gitlab_schema.rb b/app/graphql/gitlab_schema.rb
index 592167a633b..d8967da9f57 100644
--- a/app/graphql/gitlab_schema.rb
+++ b/app/graphql/gitlab_schema.rb
@@ -48,6 +48,13 @@ class GitlabSchema < GraphQL::Schema
super(query_str, **kwargs)
end
+ def get_type(type_name)
+ # This is a backwards compatibility hack to work around an accidentally
+ # released argument typed as EEIterationID
+ type_name = type_name.gsub(/^EE/, '') if type_name.end_with?('ID')
+ super(type_name)
+ end
+
def id_from_object(object, _type = nil, _ctx = nil)
unless object.respond_to?(:to_global_id)
# This is an error in our schema and needs to be solved. So raise a
@@ -77,6 +84,8 @@ class GitlabSchema < GraphQL::Schema
# will be called.
# * All other classes will use `GlobalID#find`
def find_by_gid(gid)
+ return unless gid
+
if gid.model_class < ApplicationRecord
Gitlab::Graphql::Loaders::BatchModelLoader.new(gid.model_class, gid.model_id).find
elsif gid.model_class.respond_to?(:lazy_find)
@@ -142,6 +151,13 @@ class GitlabSchema < GraphQL::Schema
end
end
end
+
+ # This is a backwards compatibility hack to work around an accidentally
+ # released argument typed as EE{Type}ID
+ def get_type(type_name)
+ type_name = type_name.gsub(/^EE/, '') if type_name.end_with?('ID')
+ super(type_name)
+ end
end
GitlabSchema.prepend_if_ee('EE::GitlabSchema') # rubocop: disable Cop/InjectEnterpriseEditionModule