Class: WorkItems::UpdateService

Inherits:
Issues::UpdateService show all
Includes:
WidgetableService
Defined in:
app/services/work_items/update_service.rb

Constant Summary

Constants inherited from Issues::BaseService

Issues::BaseService::NO_REBALANCING_NEEDED

Constants included from Gitlab::Utils::UsageData

Gitlab::Utils::UsageData::DISTRIBUTED_HLL_FALLBACK, Gitlab::Utils::UsageData::FALLBACK, Gitlab::Utils::UsageData::HISTOGRAM_FALLBACK, Gitlab::Utils::UsageData::MAX_BUCKET_SIZE

Instance Attribute Summary

Attributes inherited from BaseProjectService

#project

Attributes inherited from BaseContainerService

#container, #current_user, #params

Instance Method Summary collapse

Methods included from WidgetableService

#execute_widgets, #widget_service, #widget_service_class

Methods inherited from Issues::UpdateService

#before_update, #change_issue_duplicate, #change_work_item_type, #handle_assignee_changes, #handle_changes, #handle_task_changes, #move_issue_to_new_project

Methods inherited from Issues::BaseService

#close_service, #hook_data, #rebalance_if_needed, #reopen_service

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Methods included from Issues::IssueTypeHelpers

#create_issue_type_allowed?

Methods included from IncidentManagement::UsageData

#track_incident_action

Methods included from Gitlab::Utils::UsageData

#add, #add_metric, #alt_usage_data, #average, #count, #distinct_count, #epics_deepest_relationship_level, #estimate_batch_distinct_count, #histogram, #jira_integration_data, #maximum_id, #measure_duration, #minimum_id, #redis_usage_data, #sum, #track_usage_event, #with_duration, #with_finished_at, #with_prometheus_client

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseContainerService

#group_container?, #namespace_container?, #project_container?

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

#initialize(project:, current_user: nil, params: {}, spam_params: nil, widget_params: {}) ⇒ UpdateService

Returns a new instance of UpdateService.


7
8
9
10
11
12
13
# File 'app/services/work_items/update_service.rb', line 7

def initialize(project:, current_user: nil, params: {}, spam_params: nil, widget_params: {})
  params[:widget_params] = true if widget_params.present?

  super(project: project, current_user: current_user, params: params, spam_params: nil)

  @widget_params = widget_params
end

Instance Method Details

#execute(work_item) ⇒ Object


15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/work_items/update_service.rb', line 15

def execute(work_item)
  updated_work_item = super

  if updated_work_item.valid?
    success(payload(work_item))
  else
    error(updated_work_item.errors.full_messages, :unprocessable_entity, pass_back: payload(updated_work_item))
  end
rescue ::WorkItems::Widgets::BaseService::WidgetError => e
  error(e.message, :unprocessable_entity)
end