Handle escalation changes issue type change
What does this MR do and why?
Another MR as part of #330281 (closed).
This one handles the case where an Issue's issue_type is changed.
- When changing from Incident -> Issue
- -> All existing Pending Escalations for that Incident are destroyed
- When changing from Issue -> Incident -> An Escalation Status is created for the Incident, in the same way they would be created initially.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Issue -> Incident:
- Create an Issue
- Verify that no Escalation status is created:
Issue.last.incident_management_issuable_escalation_status
- Change the type to
Incident
via the Edit Issue screen. - Verify that the Escalation status is created:
Issue.last.incident_management_issuable_escalation_status
Incident -> Issue:
- Enable features
Feature.enable(:oncall_schedules)
Feature.enable(:escalation_policies)
Feature.enable(:incident_escalations)
- Create an Escalation Policy and rule via
Monitor -> Escalation Policies
- Create and Incident issue
- Create a pending escalation
IncidentManagement::PendingEscalations::Issue.create!(issue_id: Issue.last.id, rule_id: IncidentManagement::EscalationRule.last.id, process_at: 5.minutes.from_now)
- Verify the escalation exists
Issue.last.pending_escalations.count
=> 1 - Change the type to
Issue
via the Edit Issue screen. - Verify pending escalations are removed
Issue.last.pending_escalations.count
=> 0
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #330281 (closed)
Edited by Sean Arnold