From 8f3a9dbb94b5a9ae4570a22bbc2a75e7572407c8 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 19 Jan 2024 15:10:53 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/models/sent_notification.rb | 1 + app/models/work_items/widgets/base.rb | 8 ++++++++ app/models/work_items/widgets/hierarchy.rb | 14 ++++++++++++++ app/models/work_items/widgets/labels.rb | 4 ++++ 4 files changed, 27 insertions(+) (limited to 'app/models') diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb index f3a0479d3b7..66da5369d38 100644 --- a/app/models/sent_notification.rb +++ b/app/models/sent_notification.rb @@ -4,6 +4,7 @@ class SentNotification < ApplicationRecord belongs_to :project belongs_to :noteable, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations belongs_to :recipient, class_name: "User" + belongs_to :issue_email_participant validates :recipient, presence: true validates :reply_key, presence: true, uniqueness: true diff --git a/app/models/work_items/widgets/base.rb b/app/models/work_items/widgets/base.rb index c4e87decdbf..a3051f17158 100644 --- a/app/models/work_items/widgets/base.rb +++ b/app/models/work_items/widgets/base.rb @@ -15,10 +15,18 @@ module WorkItems [] end + def self.sync_params + [] + end + def self.process_quick_action_param(param_name, value) { param_name => value } end + def self.process_sync_params(params) + params + end + def self.callback_class WorkItems::Callbacks.const_get(name.demodulize, false) rescue NameError diff --git a/app/models/work_items/widgets/hierarchy.rb b/app/models/work_items/widgets/hierarchy.rb index fc6714f1e08..1d888dd71a8 100644 --- a/app/models/work_items/widgets/hierarchy.rb +++ b/app/models/work_items/widgets/hierarchy.rb @@ -23,6 +23,10 @@ module WorkItems [:set_parent, :add_child] end + def self.sync_params + [:parent] + end + def self.process_quick_action_param(param_name, value) return super unless param_name.in?(quick_action_params) && value.present? @@ -30,6 +34,16 @@ module WorkItems return { children: value } if param_name == :add_child end + + def self.process_sync_params(params) + parent_param = params.fetch(:parent, nil) + + if parent_param&.work_item + { parent: parent_param.work_item } + else + {} + end + end end end end diff --git a/app/models/work_items/widgets/labels.rb b/app/models/work_items/widgets/labels.rb index e8b36156fec..0b5a231deff 100644 --- a/app/models/work_items/widgets/labels.rb +++ b/app/models/work_items/widgets/labels.rb @@ -13,6 +13,10 @@ module WorkItems def self.quick_action_params [:add_label_ids, :remove_label_ids, :label_ids] end + + def self.sync_params + [:label_ids] + end end end end -- cgit v1.2.3