Class: Types::BoardListType
- Inherits:
-
BaseObject
- Object
- GraphQL::Schema::Object
- BaseObject
- Types::BoardListType
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/graphql/types/board_list_type.rb
Overview
rubocop: disable Graphql/AuthorizeTypes
Instance Method Summary collapse
- #collapsed ⇒ Object
- #issues_count ⇒ Object
- #metadata ⇒ Object
-
#title ⇒ Object
board lists have a data dependency on label - so we batch load them here.
Methods inherited from BaseObject
accepts, assignable?, authorization, authorization_scopes, authorize, authorized?, #current_user, #id
Methods included from Gitlab::Graphql::Present
Instance Method Details
#collapsed ⇒ Object
41 42 43 |
# File 'app/graphql/types/board_list_type.rb', line 41 def collapsed object.collapsed?(context[:current_user]) end |
#issues_count ⇒ Object
37 38 39 |
# File 'app/graphql/types/board_list_type.rb', line 37 def issues_count [:size] end |
#metadata ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'app/graphql/types/board_list_type.rb', line 45 def strong_memoize(:metadata) do params = (context[:issue_filters] || {}).merge(board_id: list.board_id, id: list.id) ::Boards::Issues::ListService .new(list.board.resource_parent, current_user, params) . end end |
#title ⇒ Object
board lists have a data dependency on label - so we batch load them here
56 57 58 59 60 61 62 63 |
# File 'app/graphql/types/board_list_type.rb', line 56 def title BatchLoader::GraphQL.for(object).batch do |lists, callback| ActiveRecord::Associations::Preloader.new(records: lists, associations: :label).call # all list titles are preloaded at this point lists.each { |list| callback.call(list, list.title) } end end |