diff options
Diffstat (limited to 'app/graphql/mutations/concerns')
-rw-r--r-- | app/graphql/mutations/concerns/mutations/resolves_issuable.rb | 16 | ||||
-rw-r--r-- | app/graphql/mutations/concerns/mutations/resolves_project.rb | 15 |
2 files changed, 13 insertions, 18 deletions
diff --git a/app/graphql/mutations/concerns/mutations/resolves_issuable.rb b/app/graphql/mutations/concerns/mutations/resolves_issuable.rb index d63cc27a450..13a56f2e709 100644 --- a/app/graphql/mutations/concerns/mutations/resolves_issuable.rb +++ b/app/graphql/mutations/concerns/mutations/resolves_issuable.rb @@ -3,12 +3,22 @@ module Mutations module ResolvesIssuable extend ActiveSupport::Concern - include Mutations::ResolvesProject + + included do + include ResolvesProject + end def resolve_issuable(type:, parent_path:, iid:) parent = resolve_issuable_parent(type, parent_path) + key = type == :merge_request ? :iids : :iid + args = { key => iid.to_s } + + resolver = issuable_resolver(type, parent, context) + ready, early_return = resolver.ready?(**args) + + return early_return unless ready - issuable_resolver(type, parent, context).resolve(iid: iid.to_s) + resolver.resolve(**args) end private @@ -22,7 +32,7 @@ module Mutations def resolve_issuable_parent(type, parent_path) return unless type == :issue || type == :merge_request - resolve_project(full_path: parent_path) + resolve_project(full_path: parent_path) if parent_path.present? end end end diff --git a/app/graphql/mutations/concerns/mutations/resolves_project.rb b/app/graphql/mutations/concerns/mutations/resolves_project.rb deleted file mode 100644 index e223e3edd94..00000000000 --- a/app/graphql/mutations/concerns/mutations/resolves_project.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module ResolvesProject - extend ActiveSupport::Concern - - def resolve_project(full_path:) - project_resolver.resolve(full_path: full_path) - end - - def project_resolver - Resolvers::ProjectResolver.new(object: nil, context: context, field: nil) - end - end -end |