Module: WorkItems::WidgetableService
- Extended by:
- ActiveSupport::Concern
- Included in:
- CreateService, UpdateService
- Defined in:
- app/services/concerns/work_items/widgetable_service.rb
Instance Method Summary collapse
-
#handle_quick_actions(work_item) ⇒ Object
rubocop:enable Gitlab/ModuleWithInstanceVariables.
-
#initialize_callbacks!(work_item) ⇒ Object
rubocop:disable Gitlab/ModuleWithInstanceVariables.
- #params_include_state_and_status_changes? ⇒ Boolean
Instance Method Details
#handle_quick_actions(work_item) ⇒ Object
rubocop:enable Gitlab/ModuleWithInstanceVariables
34 35 36 37 38 39 40 41 42 43 |
# File 'app/services/concerns/work_items/widgetable_service.rb', line 34 def handle_quick_actions(work_item) # Unify description parameters into widget params for quick action processing if params[:description].present? = [::WorkItems::Widgets::Description.api_symbol] ||= {} .reverse_merge!(params.slice(:description)) end # Handle quick actions from description widget depending on the available widgets for the type (work_item) end |
#initialize_callbacks!(work_item) ⇒ Object
rubocop:disable Gitlab/ModuleWithInstanceVariables
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/services/concerns/work_items/widgetable_service.rb', line 12 def initialize_callbacks!(work_item) @callbacks = work_item..filter_map do || callback_class = .class.try(:callback_class) next if callback_class.nil? callback_params = [.class.api_symbol] || {} callback_params[:excluded_in_new_type] = true if (, work_item.resource_parent) if callback_class.const_defined?(:ALLOWED_PARAMS) callback_params.reverse_merge!(params.slice(*callback_class::ALLOWED_PARAMS)) end next if callback_params.blank? && !execute_without_params(callback_class) callback_class.new(issuable: work_item, current_user: current_user, params: callback_params) end remove_callback_params @callbacks.each(&:after_initialize) end |
#params_include_state_and_status_changes? ⇒ Boolean
45 46 47 |
# File 'app/services/concerns/work_items/widgetable_service.rb', line 45 def params_include_state_and_status_changes? params.include?(:state_event) && .dig(:status_widget, :status) end |