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>2022-02-18 12:45:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 12:45:46 +0300
commita7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch)
tree7452bd5c3545c2fa67a28aa013835fb4fa071baf /app/services/alert_management
parentee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff)
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'app/services/alert_management')
-rw-r--r--app/services/alert_management/alerts/update_service.rb15
-rw-r--r--app/services/alert_management/create_alert_issue_service.rb13
2 files changed, 12 insertions, 16 deletions
diff --git a/app/services/alert_management/alerts/update_service.rb b/app/services/alert_management/alerts/update_service.rb
index 7a9bcf2a52d..0769adc862e 100644
--- a/app/services/alert_management/alerts/update_service.rb
+++ b/app/services/alert_management/alerts/update_service.rb
@@ -12,6 +12,7 @@ module AlertManagement
@alert = alert
@param_errors = []
@status = params.delete(:status)
+ @status_change_reason = params.delete(:status_change_reason)
super(project: alert.project, current_user: current_user, params: params)
end
@@ -36,7 +37,7 @@ module AlertManagement
private
- attr_reader :alert, :param_errors, :status
+ attr_reader :alert, :param_errors, :status, :status_change_reason
def allowed?
current_user&.can?(:update_alert_management_alert, alert)
@@ -133,7 +134,7 @@ module AlertManagement
end
def add_status_change_system_note
- SystemNoteService.change_alert_status(alert, current_user)
+ SystemNoteService.change_alert_status(alert, current_user, status_change_reason)
end
def resolve_todos
@@ -144,13 +145,17 @@ module AlertManagement
::Issues::UpdateService.new(
project: project,
current_user: current_user,
- params: { escalation_status: { status: status } }
+ params: {
+ escalation_status: {
+ status: status,
+ status_change_reason: " by changing the status of #{alert.to_reference(project)}"
+ }
+ }
).execute(alert.issue)
end
def should_sync_to_incident?
- Feature.enabled?(:incident_escalations, project) &&
- alert.issue &&
+ alert.issue &&
alert.issue.supports_escalation? &&
alert.issue.escalation_status &&
alert.issue.escalation_status.status != alert.status
diff --git a/app/services/alert_management/create_alert_issue_service.rb b/app/services/alert_management/create_alert_issue_service.rb
index a81c2380dad..ab8d1176b9e 100644
--- a/app/services/alert_management/create_alert_issue_service.rb
+++ b/app/services/alert_management/create_alert_issue_service.rb
@@ -22,8 +22,6 @@ module AlertManagement
return result unless result.success?
issue = result.payload[:issue]
- return error(object_errors(alert), issue) unless associate_alert_with_issue(issue)
-
update_title_for(issue)
SystemNoteService.new_alert_issue(alert, issue, user)
@@ -47,14 +45,11 @@ module AlertManagement
user,
title: alert_presenter.title,
description: alert_presenter.issue_description,
- severity: alert.severity
+ severity: alert.severity,
+ alert: alert
).execute
end
- def associate_alert_with_issue(issue)
- alert.update(issue_id: issue.id)
- end
-
def update_title_for(issue)
return unless issue.title == DEFAULT_ALERT_TITLE
@@ -78,9 +73,5 @@ module AlertManagement
alert.present
end
end
-
- def object_errors(object)
- object.errors.full_messages.to_sentence
- end
end
end