Skip to content

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:

  1. Create an Issue
  2. Verify that no Escalation status is created: Issue.last.incident_management_issuable_escalation_status
  3. Change the type to Incident via the Edit Issue screen.
  4. Verify that the Escalation status is created: Issue.last.incident_management_issuable_escalation_status

Incident -> Issue:

  1. Enable features
Feature.enable(:oncall_schedules)
Feature.enable(:escalation_policies)
Feature.enable(:incident_escalations)
  1. Create an Escalation Policy and rule via Monitor -> Escalation Policies
  2. Create and Incident issue
  3. 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)
  4. Verify the escalation exists Issue.last.pending_escalations.count => 1
  5. Change the type to Issue via the Edit Issue screen.
  6. 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.

Related to #330281 (closed)

Edited by Sean Arnold

Merge request reports