diff options
Diffstat (limited to 'app/graphql/mutations/concerns/mutations/resolves_issuable.rb')
-rw-r--r-- | app/graphql/mutations/concerns/mutations/resolves_issuable.rb | 16 |
1 files changed, 13 insertions, 3 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 |