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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-24 21:09:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-24 21:09:05 +0300
commitc2367afbf57ebc65d5b78a743b5d6a91f0aece9f (patch)
tree165c2c54bf72ab3a3a9417d97f63ece5c9eba9f5 /app/graphql
parent51a9512965d86e3094968fa514e4ae8a96d38cf3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql')
-rw-r--r--app/graphql/resolvers/boards_resolver.rb18
-rw-r--r--app/graphql/types/group_type.rb6
-rw-r--r--app/graphql/types/project_type.rb6
3 files changed, 28 insertions, 2 deletions
diff --git a/app/graphql/resolvers/boards_resolver.rb b/app/graphql/resolvers/boards_resolver.rb
index 45c03bf0bef..eceb5b38031 100644
--- a/app/graphql/resolvers/boards_resolver.rb
+++ b/app/graphql/resolvers/boards_resolver.rb
@@ -4,7 +4,11 @@ module Resolvers
class BoardsResolver < BaseResolver
type Types::BoardType, null: true
- def resolve(**args)
+ argument :id, GraphQL::ID_TYPE,
+ required: false,
+ description: 'Find a board by its ID'
+
+ def resolve(id: nil)
# The project or group could have been loaded in batch by `BatchLoader`.
# At this point we need the `id` of the project/group to query for boards, so
# make sure it's loaded and not `nil` before continuing.
@@ -12,7 +16,17 @@ module Resolvers
return Board.none unless parent
- Boards::ListService.new(parent, context[:current_user]).execute(create_default_board: false)
+ Boards::ListService.new(parent, context[:current_user], board_id: extract_board_id(id)).execute(create_default_board: false)
+ rescue ActiveRecord::RecordNotFound
+ Board.none
+ end
+
+ private
+
+ def extract_board_id(gid)
+ return unless gid.present?
+
+ GitlabSchema.parse_gid(gid, expected_type: ::Board).model_id
end
end
end
diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb
index 9f3905000b2..699aa51e6c8 100644
--- a/app/graphql/types/group_type.rb
+++ b/app/graphql/types/group_type.rb
@@ -52,6 +52,12 @@ module Types
null: true,
description: 'Boards of the group',
resolver: Resolvers::BoardsResolver
+
+ field :board,
+ Types::BoardType,
+ null: true,
+ description: 'A single board of the group',
+ resolver: Resolvers::BoardsResolver.single
end
end
diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb
index f89bd5575a3..1142459f6eb 100644
--- a/app/graphql/types/project_type.rb
+++ b/app/graphql/types/project_type.rb
@@ -185,6 +185,12 @@ module Types
null: true,
description: 'Boards of the project',
resolver: Resolvers::BoardsResolver
+
+ field :board,
+ Types::BoardType,
+ null: true,
+ description: 'A single board of the project',
+ resolver: Resolvers::BoardsResolver.single
end
end