Module: Mutations::WorkItems::Widgetable

Extended by:
ActiveSupport::Concern
Included in:
Create, Update
Defined in:
app/graphql/mutations/concerns/mutations/work_items/widgetable.rb

Instance Method Summary collapse

Instance Method Details

#extract_widget_params(work_item_type, attributes) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'app/graphql/mutations/concerns/mutations/work_items/widgetable.rb', line 8

def extract_widget_params(work_item_type, attributes)
  # Get the list of widgets for the work item's type to extract only the supported attributes
  widget_keys = work_item_type.widgets.map(&:api_symbol)
  widget_params = attributes.extract!(*widget_keys)

  # Cannot use prepare to use `.to_h` on each input due to
  # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87472#note_945199865
  widget_params.transform_values { |values| values.to_h }
end