diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/graphql/resolvers/board_lists_resolver.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/graphql/resolvers/board_lists_resolver.rb')
-rw-r--r-- | app/graphql/resolvers/board_lists_resolver.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/app/graphql/resolvers/board_lists_resolver.rb b/app/graphql/resolvers/board_lists_resolver.rb index f8d62ba86af..b1d43934f24 100644 --- a/app/graphql/resolvers/board_lists_resolver.rb +++ b/app/graphql/resolvers/board_lists_resolver.rb @@ -6,12 +6,16 @@ module Resolvers type Types::BoardListType, null: true + argument :id, GraphQL::ID_TYPE, + required: false, + description: 'Find a list by its global ID' + alias_method :board, :object - def resolve(lookahead: nil) + def resolve(lookahead: nil, id: nil) authorize!(board) - lists = board_lists + lists = board_lists(id) if load_preferences?(lookahead) List.preload_preferences_for_user(lists, context[:current_user]) @@ -22,8 +26,13 @@ module Resolvers private - def board_lists - service = Boards::Lists::ListService.new(board.resource_parent, context[:current_user]) + def board_lists(id) + service = Boards::Lists::ListService.new( + board.resource_parent, + context[:current_user], + list_id: extract_list_id(id) + ) + service.execute(board, create_default_lists: false) end @@ -34,5 +43,11 @@ module Resolvers def load_preferences?(lookahead) lookahead&.selection(:edges)&.selection(:node)&.selects?(:collapsed) end + + def extract_list_id(gid) + return unless gid.present? + + GitlabSchema.parse_gid(gid, expected_type: ::List).model_id + end end end |