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:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/click_house/sync_strategies/base_sync_strategy.rb2
-rw-r--r--app/services/issuable_base_service.rb5
-rw-r--r--app/services/namespace_settings/update_service.rb4
-rw-r--r--app/services/notification_service.rb10
-rw-r--r--app/services/work_items/create_service.rb15
-rw-r--r--app/services/work_items/widgets/labels_service/base_service.rb25
-rw-r--r--app/services/work_items/widgets/labels_service/create_service.rb18
-rw-r--r--app/services/work_items/widgets/labels_service/update_service.rb12
8 files changed, 77 insertions, 14 deletions
diff --git a/app/services/click_house/sync_strategies/base_sync_strategy.rb b/app/services/click_house/sync_strategies/base_sync_strategy.rb
index 58c2161b83c..54f0f084d05 100644
--- a/app/services/click_house/sync_strategies/base_sync_strategy.rb
+++ b/app/services/click_house/sync_strategies/base_sync_strategy.rb
@@ -41,7 +41,7 @@ module ClickHouse
private
def enabled?
- ClickHouse::Client.database_configured?(:main)
+ Gitlab::ClickHouse.configured?
end
def context
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb
index 0240d0184ac..27c52fc7303 100644
--- a/app/services/issuable_base_service.rb
+++ b/app/services/issuable_base_service.rb
@@ -227,6 +227,7 @@ class IssuableBaseService < ::BaseContainerService
def create(issuable, skip_system_notes: false)
initialize_callbacks!(issuable)
+ prepare_create_params(issuable)
handle_quick_actions(issuable)
filter_params(issuable)
@@ -289,6 +290,10 @@ class IssuableBaseService < ::BaseContainerService
# To be overridden by subclasses
end
+ def prepare_create_params(issuable)
+ # To be overridden by subclasses
+ end
+
def after_update(issuable, old_associations)
handle_description_updated(issuable)
handle_label_changes(issuable, old_associations[:labels])
diff --git a/app/services/namespace_settings/update_service.rb b/app/services/namespace_settings/update_service.rb
index 92766bc0267..f6f59738d44 100644
--- a/app/services/namespace_settings/update_service.rb
+++ b/app/services/namespace_settings/update_service.rb
@@ -31,6 +31,10 @@ module NamespaceSettings
param_key: :default_branch_protection_defaults,
user_policy: :update_default_branch_protection
)
+ validate_settings_param_for_root_group(
+ param_key: :enabled_git_access_protocol,
+ user_policy: :update_git_access_protocol
+ )
handle_default_branch_protection unless settings_params[:default_branch_protection].blank?
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 36431c1cbde..3c40707d0c6 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -446,14 +446,18 @@ class NotificationService
return unless note.project.service_desk_enabled?
issue = note.noteable
- recipients = issue.email_participants_emails
+ recipients = issue.issue_email_participants
return unless recipients.any?
- support_bot = Users::Internal.support_bot
- recipients.delete(issue.external_author) if note.author == support_bot
+ # Only populated if note is from external participant
+ note_external_author = note.note_metadata&.email_participant&.downcase
recipients.each do |recipient|
+ # Don't send Service Desk notification if the recipient is the author of the note.
+ # We store emails as-is but compare downcased versions.
+ next if recipient.email.downcase == note_external_author
+
mailer.service_desk_new_note_email(issue.id, note.id, recipient).deliver_later
Gitlab::Metrics::BackgroundTransaction.current&.add_event(:service_desk_new_note_email)
end
diff --git a/app/services/work_items/create_service.rb b/app/services/work_items/create_service.rb
index f9eadc3fb60..e1e6063c8ac 100644
--- a/app/services/work_items/create_service.rb
+++ b/app/services/work_items/create_service.rb
@@ -53,6 +53,21 @@ module WorkItems
end
end
+ def prepare_create_params(work_item)
+ execute_widgets(
+ work_item: work_item,
+ callback: :prepare_create_params,
+ widget_params: @widget_params,
+ service_params: params
+ )
+
+ super
+ end
+
+ def parent
+ container
+ end
+
private
override :handle_quick_actions
diff --git a/app/services/work_items/widgets/labels_service/base_service.rb b/app/services/work_items/widgets/labels_service/base_service.rb
new file mode 100644
index 00000000000..2d679c1f18c
--- /dev/null
+++ b/app/services/work_items/widgets/labels_service/base_service.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+module WorkItems
+ module Widgets
+ module LabelsService
+ class BaseService < WorkItems::Widgets::BaseService
+ private
+
+ def prepare_params(params: {}, permitted_params: [])
+ clear_label_params(params) if new_type_excludes_widget?
+
+ return if params.blank?
+ return unless has_permission?(:set_work_item_metadata)
+
+ service_params.merge!(params.slice(*permitted_params))
+ end
+
+ def clear_label_params(params)
+ params[:remove_label_ids] = @work_item.labels.map(&:id)
+ params[:add_label_ids] = []
+ end
+ end
+ end
+ end
+end
diff --git a/app/services/work_items/widgets/labels_service/create_service.rb b/app/services/work_items/widgets/labels_service/create_service.rb
new file mode 100644
index 00000000000..bed6be173cc
--- /dev/null
+++ b/app/services/work_items/widgets/labels_service/create_service.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module WorkItems
+ module Widgets
+ module LabelsService
+ class CreateService < BaseService
+ def prepare_create_params(params: {})
+ prepare_params(params: params, permitted_params: %i[add_label_ids remove_label_ids label_ids])
+ end
+
+ def clear_label_params(params)
+ params[:add_label_ids] = []
+ params[:label_ids] = []
+ end
+ end
+ end
+ end
+end
diff --git a/app/services/work_items/widgets/labels_service/update_service.rb b/app/services/work_items/widgets/labels_service/update_service.rb
index b0791571924..780451e3eae 100644
--- a/app/services/work_items/widgets/labels_service/update_service.rb
+++ b/app/services/work_items/widgets/labels_service/update_service.rb
@@ -3,17 +3,9 @@
module WorkItems
module Widgets
module LabelsService
- class UpdateService < WorkItems::Widgets::BaseService
+ class UpdateService < BaseService
def prepare_update_params(params: {})
- if new_type_excludes_widget?
- params[:remove_label_ids] = @work_item.labels.map(&:id)
- params[:add_label_ids] = []
- end
-
- return if params.blank?
- return unless has_permission?(:set_work_item_metadata)
-
- service_params.merge!(params.slice(:add_label_ids, :remove_label_ids))
+ prepare_params(params: params, permitted_params: %i[add_label_ids remove_label_ids])
end
end
end