diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-26 00:08:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-26 00:08:43 +0300 |
commit | 3e2ef953d9a22cb3139e7b395a1173604c563007 (patch) | |
tree | 3e22e05affc55017866fca8ff1269b777c52595c /app/graphql/resolvers | |
parent | 35487a1e925f7b4ec72a3d0cdde94f92582d2087 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/resolvers')
-rw-r--r-- | app/graphql/resolvers/boards_resolver.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/graphql/resolvers/boards_resolver.rb b/app/graphql/resolvers/boards_resolver.rb new file mode 100644 index 00000000000..45c03bf0bef --- /dev/null +++ b/app/graphql/resolvers/boards_resolver.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Resolvers + class BoardsResolver < BaseResolver + type Types::BoardType, null: true + + def resolve(**args) + # 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. + parent = object.respond_to?(:sync) ? object.sync : object + + return Board.none unless parent + + Boards::ListService.new(parent, context[:current_user]).execute(create_default_board: false) + end + end +end |