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/types/global_id_type.rb')
-rw-r--r--app/graphql/types/global_id_type.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/graphql/types/global_id_type.rb b/app/graphql/types/global_id_type.rb
index a3964ba83e1..9ae9ba32c13 100644
--- a/app/graphql/types/global_id_type.rb
+++ b/app/graphql/types/global_id_type.rb
@@ -1,5 +1,21 @@
# frozen_string_literal: true
+module GraphQLExtensions
+ module ScalarExtensions
+ # Allow ID to unify with GlobalID Types
+ def ==(other)
+ if name == 'ID' && other.is_a?(self.class) &&
+ other.type_class.ancestors.include?(::Types::GlobalIDType)
+ return true
+ end
+
+ super
+ end
+ end
+end
+
+::GraphQL::ScalarType.prepend(GraphQLExtensions::ScalarExtensions)
+
module Types
class GlobalIDType < BaseScalar
graphql_name 'GlobalID'