debian-mirror-gitlab/app/services/work_items/update_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
803 B
Ruby
Raw Normal View History

2022-04-04 11:22:00 +05:30
# frozen_string_literal: true
module WorkItems
class UpdateService < ::Issues::UpdateService
2022-07-23 23:45:48 +05:30
def initialize(project:, current_user: nil, params: {}, spam_params: nil, widget_params: {})
super(project: project, current_user: current_user, params: params, spam_params: nil)
@widget_params = widget_params
end
2022-04-04 11:22:00 +05:30
private
2022-07-23 23:45:48 +05:30
def update(work_item)
execute_widgets(work_item: work_item, callback: :update)
2022-04-04 11:22:00 +05:30
super
2022-07-23 23:45:48 +05:30
end
def after_update(work_item)
super
GraphqlTriggers.issuable_title_updated(work_item) if work_item.previous_changes.key?(:title)
end
2022-04-04 11:22:00 +05:30
2022-07-23 23:45:48 +05:30
def execute_widgets(work_item:, callback:)
work_item.widgets.each do |widget|
widget.try(callback, params: @widget_params[widget.class.api_symbol])
end
2022-04-04 11:22:00 +05:30
end
end
end