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-01-21 21:12:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-21 21:12:45 +0300
commit6be1f63eb6ca987f959c18576bb9042b9ee7726b (patch)
treecb15e23f3087776b54c4190d9aec4aa0c507ffb5 /app/services/incident_management
parent48fc1ad8991a96ef2eaa927bb6df3bfab2c78e46 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/incident_management')
-rw-r--r--app/services/incident_management/issuable_escalation_statuses/after_update_service.rb18
-rw-r--r--app/services/incident_management/issuable_escalation_statuses/prepare_update_service.rb2
2 files changed, 14 insertions, 6 deletions
diff --git a/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb b/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb
index a7a99f88b32..b7f8b268f18 100644
--- a/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb
+++ b/app/services/incident_management/issuable_escalation_statuses/after_update_service.rb
@@ -3,12 +3,12 @@
module IncidentManagement
module IssuableEscalationStatuses
class AfterUpdateService < ::BaseProjectService
- def initialize(issuable, current_user)
+ def initialize(issuable, current_user, **params)
@issuable = issuable
@escalation_status = issuable.escalation_status
@alert = issuable.alert_management_alert
- super(project: issuable.project, current_user: current_user)
+ super(project: issuable.project, current_user: current_user, params: params)
end
def execute
@@ -22,19 +22,27 @@ module IncidentManagement
attr_reader :issuable, :escalation_status, :alert
def after_update
- sync_to_alert
+ sync_status_to_alert
+ add_status_system_note
end
- def sync_to_alert
+ def sync_status_to_alert
return unless alert
return if alert.status == escalation_status.status
::AlertManagement::Alerts::UpdateService.new(
alert,
current_user,
- status: escalation_status.status_name
+ status: escalation_status.status_name,
+ status_change_reason: " by changing the incident status of #{issuable.to_reference(project)}"
).execute
end
+
+ def add_status_system_note
+ return unless escalation_status.status_previously_changed?
+
+ SystemNoteService.change_incident_status(issuable, current_user, params[:status_change_reason])
+ end
end
end
end
diff --git a/app/services/incident_management/issuable_escalation_statuses/prepare_update_service.rb b/app/services/incident_management/issuable_escalation_statuses/prepare_update_service.rb
index 1a660e1a163..319d1e8f899 100644
--- a/app/services/incident_management/issuable_escalation_statuses/prepare_update_service.rb
+++ b/app/services/incident_management/issuable_escalation_statuses/prepare_update_service.rb
@@ -5,7 +5,7 @@ module IncidentManagement
class PrepareUpdateService
include Gitlab::Utils::StrongMemoize
- SUPPORTED_PARAMS = %i[status].freeze
+ SUPPORTED_PARAMS = %i[status status_change_reason].freeze
InvalidParamError = Class.new(StandardError)