Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-23 21:15:39 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-23 21:15:39 +0300
commit68caf5fd883a7fd5a3395c2e5ae2a5c511445613 (patch)
tree7a63a675e90f9819e32dc9927d3a1fae6e3ffe75 /app/services/concerns
parent003d7f2a09668af85f94e48ed49d60862b96d8f8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/concerns')
-rw-r--r--app/services/concerns/work_items/widgetable_service.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/concerns/work_items/widgetable_service.rb b/app/services/concerns/work_items/widgetable_service.rb
index 24ade9336b2..965d1cee55d 100644
--- a/app/services/concerns/work_items/widgetable_service.rb
+++ b/app/services/concerns/work_items/widgetable_service.rb
@@ -2,6 +2,21 @@
module WorkItems
module WidgetableService
+ # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ def initialize_callbacks!(work_item)
+ @callbacks = work_item.widgets.filter_map do |widget|
+ callback_class = widget.class.try(:callback_class)
+ callback_params = @widget_params[widget.class.api_symbol]
+
+ next if callback_class.nil? || callback_params.blank?
+
+ callback_class.new(issuable: work_item, current_user: current_user, params: callback_params)
+ end
+
+ @callbacks.each(&:after_initialize)
+ end
+ # rubocop:enable Gitlab/ModuleWithInstanceVariables
+
def execute_widgets(work_item:, callback:, widget_params: {}, service_params: {})
work_item.widgets.each do |widget|
widget_service(widget, service_params).try(callback, params: widget_params[widget.class.api_symbol])