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>2021-03-16 21:18:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 21:18:33 +0300
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /app/services/alert_management
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'app/services/alert_management')
-rw-r--r--app/services/alert_management/create_alert_issue_service.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/services/alert_management/create_alert_issue_service.rb b/app/services/alert_management/create_alert_issue_service.rb
index 58c7402c6c1..a81c2380dad 100644
--- a/app/services/alert_management/create_alert_issue_service.rb
+++ b/app/services/alert_management/create_alert_issue_service.rb
@@ -4,6 +4,9 @@ module AlertManagement
class CreateAlertIssueService
include Gitlab::Utils::StrongMemoize
+ DEFAULT_ALERT_TITLE = ::Gitlab::AlertManagement::Payload::Generic::DEFAULT_TITLE
+ DEFAULT_INCIDENT_TITLE = 'New: Incident'
+
# @param alert [AlertManagement::Alert]
# @param user [User]
def initialize(alert, user)
@@ -21,6 +24,8 @@ module AlertManagement
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)
result
@@ -50,6 +55,12 @@ module AlertManagement
alert.update(issue_id: issue.id)
end
+ def update_title_for(issue)
+ return unless issue.title == DEFAULT_ALERT_TITLE
+
+ issue.update!(title: "#{DEFAULT_INCIDENT_TITLE} #{issue.iid}")
+ end
+
def error(message, issue = nil)
ServiceResponse.error(payload: { issue: issue }, message: message)
end