diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 11:18:50 +0000 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/graphql/mutations/concerns | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) | |
download | gitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
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 |