summaryrefslogtreecommitdiff
path: root/app/services/incident_management
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-06 12:08:29 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-06 12:08:29 +0000
commit39c98649d20e08428f507e0728b0bd87a299e5cf (patch)
tree6ca0ae12d9498f9158b7f8da9bad97f1517b0d83 /app/services/incident_management
parentc16b752f86f78442349b7b2cd9106109de10763b (diff)
downloadgitlab-ce-39c98649d20e08428f507e0728b0bd87a299e5cf.tar.gz
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/prepare_update_service.rb13
1 files changed, 12 insertions, 1 deletions
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 1d0504a6e80..d755cf61207 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
@@ -31,7 +31,10 @@ module IncidentManagement
attr_reader :issuable, :param_errors
def available?
- issuable.supports_escalation? && user_has_permissions?
+ (
+ issuable.supports_escalation? ||
+ issuable.sync_escalation_attributes_from_alert? # Remove with https://gitlab.com/gitlab-org/gitlab/-/issues/345769
+ ) && user_has_permissions?
end
def user_has_permissions?
@@ -60,6 +63,14 @@ module IncidentManagement
status = params.delete(:status)
return unless status
+ # If we're updating the escalation status because the
+ # alert was updated & the feature flag is disabled, then
+ # we should not allow the status to be different from the alert's.
+ # Remove with https://gitlab.com/gitlab-org/gitlab/-/issues/345769
+ if issuable.sync_escalation_attributes_from_alert? && status != issuable.alert_management_alert.status_name
+ add_param_error(:status) && return
+ end
+
status_event = escalation_status.status_event_for(status)
add_param_error(:status) && return unless status_event