Class: Types::WorkItems::Widgets::HierarchyType
- Inherits:
-
BaseObject
- Object
- GraphQL::Schema::Object
- BaseObject
- Types::WorkItems::Widgets::HierarchyType
- Defined in:
- app/graphql/types/work_items/widgets/hierarchy_type.rb
Overview
Disabling widget level authorization as it might be too granular and we already authorize the parent work item rubocop:disable Graphql/AuthorizeTypes
Class Method Summary collapse
Instance Method Summary collapse
-
#has_children? ⇒ Boolean
(also: #has_children)
rubocop: disable CodeReuse/ActiveRecord.
Methods inherited from BaseObject
accepts, assignable?, authorization, authorize, authorized?, #current_user, #id
Methods included from Gitlab::Graphql::Present
Class Method Details
.authorization_scopes ⇒ Object
15 16 17 |
# File 'app/graphql/types/work_items/widgets/hierarchy_type.rb', line 15 def self. super + [:ai_workflows] end |
Instance Method Details
#has_children? ⇒ Boolean Also known as: has_children
rubocop: disable CodeReuse/ActiveRecord
55 56 57 58 59 60 61 62 63 64 |
# File 'app/graphql/types/work_items/widgets/hierarchy_type.rb', line 55 def has_children? BatchLoader::GraphQL.for(object.work_item.id).batch(default_value: false) do |ids, loader| links_for_parents = ::WorkItems::ParentLink.for_parents(ids) .select(:work_item_parent_id) .group(:work_item_parent_id) .without_order links_for_parents.each { |link| loader.call(link.work_item_parent_id, true) } end end |