Class: WorkItems::Widgets::LabelsService::UpdateService

Inherits:
BaseService show all
Defined in:
app/services/work_items/widgets/labels_service/update_service.rb

Constant Summary

Constants inherited from BaseService

BaseService::WidgetError

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #service_params, #widget, #work_item

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from WorkItems::Widgets::BaseService

Instance Method Details

#prepare_update_params(params: {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'app/services/work_items/widgets/labels_service/update_service.rb', line 7

def prepare_update_params(params: {})
  if new_type_excludes_widget?
    params[:remove_label_ids] = @work_item.labels.map(&:id)
    params[:add_label_ids] = []
  end

  return if params.blank?

  service_params.merge!(params.slice(:add_label_ids, :remove_label_ids))
end