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/types/board_list_type.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/graphql/types/board_list_type.rb')
-rw-r--r-- | app/graphql/types/board_list_type.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/graphql/types/board_list_type.rb b/app/graphql/types/board_list_type.rb index e94ff898807..70c0794fc90 100644 --- a/app/graphql/types/board_list_type.rb +++ b/app/graphql/types/board_list_type.rb @@ -3,6 +3,8 @@ module Types # rubocop: disable Graphql/AuthorizeTypes class BoardListType < BaseObject + include Gitlab::Utils::StrongMemoize + graphql_name 'BoardList' description 'Represents a list for an issue board' @@ -19,6 +21,31 @@ module Types field :collapsed, GraphQL::BOOLEAN_TYPE, null: true, description: 'Indicates if list is collapsed for this user', resolve: -> (list, _args, ctx) { list.collapsed?(ctx[:current_user]) } + field :issues_count, GraphQL::INT_TYPE, null: true, + description: 'Count of issues in the list' + + field :issues, ::Types::IssueType.connection_type, null: true, + description: 'Board issues', + resolver: ::Resolvers::BoardListIssuesResolver + + def issues_count + metadata[:size] + end + + def total_weight + metadata[:total_weight] + end + + def metadata + strong_memoize(:metadata) do + list = self.object + user = context[:current_user] + + Boards::Issues::ListService + .new(list.board.resource_parent, user, board_id: list.board_id, id: list.id) + .metadata + end + end end # rubocop: enable Graphql/AuthorizeTypes end |