summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-02-13 00:31:18 +0800
committerLin Jen-Shin <godfat@godfat.org>2019-02-14 15:52:17 +0800
commit30918929ad079a591b85303d6662ec0a43c5df04 (patch)
treef35921b065d6d8a748768c2ec1bb05bbe401003b /app
parent564b86a3145cd5f7eae8071ef244dc684bcd5031 (diff)
downloadgitlab-ce-30918929ad079a591b85303d6662ec0a43c5df04.tar.gz
Implement singular iid for IssuesResolver and ProjectType
Diffstat (limited to 'app')
-rw-r--r--app/graphql/resolvers/issues_resolver.rb5
-rw-r--r--app/graphql/resolvers/merge_requests_resolver.rb6
-rw-r--r--app/graphql/types/project_type.rb5
3 files changed, 12 insertions, 4 deletions
diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb
index 95e66fb3b7c..fd1b46ba860 100644
--- a/app/graphql/resolvers/issues_resolver.rb
+++ b/app/graphql/resolvers/issues_resolver.rb
@@ -2,7 +2,9 @@
module Resolvers
class IssuesResolver < BaseResolver
- extend ActiveSupport::Concern
+ argument :iid, GraphQL::ID_TYPE,
+ required: false,
+ description: 'The IID of the issue, e.g., "1"'
argument :iids, [GraphQL::ID_TYPE],
required: false,
@@ -22,6 +24,7 @@ module Resolvers
# Will need to be be made group & namespace aware with
# https://gitlab.com/gitlab-org/gitlab-ce/issues/54520
args[:project_id] = project.id
+ args[:iids] ||= [args[:iid]].compact
IssuesFinder.new(context[:current_user], args).execute
end
diff --git a/app/graphql/resolvers/merge_requests_resolver.rb b/app/graphql/resolvers/merge_requests_resolver.rb
index 15055db633a..0b394386f97 100644
--- a/app/graphql/resolvers/merge_requests_resolver.rb
+++ b/app/graphql/resolvers/merge_requests_resolver.rb
@@ -3,8 +3,8 @@
module Resolvers
class MergeRequestsResolver < BaseResolver
argument :iid, GraphQL::ID_TYPE,
- required: false,
- description: 'The IID of the merge request, e.g., "1"'
+ required: false,
+ description: 'The IID of the merge request, e.g., "1"'
argument :iids, [GraphQL::ID_TYPE],
required: false,
@@ -17,7 +17,7 @@ module Resolvers
def resolve(**args)
return unless project.present?
- args[:iids] ||= [args[:iid]]
+ args[:iids] ||= [args[:iid]].compact
args[:iids].map(&method(:batch_load))
.select(&:itself) # .compact doesn't work on BatchLoader
diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb
index 9d21a7dee67..d25c8c8bd90 100644
--- a/app/graphql/types/project_type.rb
+++ b/app/graphql/types/project_type.rb
@@ -85,6 +85,11 @@ module Types
null: true,
resolver: Resolvers::IssuesResolver
+ field :issue,
+ Types::IssueType,
+ null: true,
+ resolver: Resolvers::IssuesResolver.single
+
field :pipelines,
Types::Ci::PipelineType.connection_type,
null: false,