summaryrefslogtreecommitdiff
path: root/app/graphql/types/work_items/widgets/labels_type.rb
blob: 20574b3e3bc72a0713525b9530e931d0c5cbe657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Types
  module WorkItems
    module Widgets
      # Disabling widget level authorization as it might be too granular
      # and we already authorize the parent work item
      # rubocop:disable Graphql/AuthorizeTypes
      class LabelsType < BaseObject
        graphql_name 'WorkItemWidgetLabels'
        description 'Represents the labels widget'

        implements Types::WorkItems::WidgetInterface

        field :labels, Types::LabelType.connection_type,
          null: true,
          description: 'Labels assigned to the work item.'

        field :allows_scoped_labels, GraphQL::Types::Boolean,
          null: true,
          method: :allows_scoped_labels?,
          description: 'Indicates whether a scoped label is allowed.'
      end
      # rubocop:enable Graphql/AuthorizeTypes
    end
  end
end