diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /app/services/alert_management | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) | |
download | gitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz |
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.rb | 11 |
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 |