Skip to content

Commit

Permalink
Do not overwrite the title, incident priority, and incident type fiel…
Browse files Browse the repository at this point in the history
…ds during case escalation. (#5219)

* Do not overwrite the title, incident priority, and incident type fields during case escalation.

* Format for consistency.
  • Loading branch information
metroid-samus authored Sep 18, 2024
1 parent ab6fd28 commit 1cb1451
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/dispatch/case/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,9 @@ def case_escalated_status_flow(
case: Case,
organization_slug: OrganizationSlug,
db_session: Session,
incident_priority: IncidentType | None,
incident_type: IncidentPriority | None,
title: str | None,
incident_priority: IncidentPriority | None,
incident_type: IncidentType | None,
incident_description: str | None,
):
"""Runs the case escalated transition flow."""
Expand All @@ -457,6 +458,7 @@ def case_escalated_status_flow(
case=case,
organization_slug=organization_slug,
db_session=db_session,
title=title,
incident_priority=incident_priority,
incident_type=incident_type,
incident_description=incident_description,
Expand Down Expand Up @@ -792,6 +794,7 @@ def case_to_incident_escalate_flow(
case: Case,
organization_slug: OrganizationSlug,
db_session: Session,
title: str | None,
incident_priority: IncidentPriority | None,
incident_type: IncidentType,
incident_description: str | None,
Expand All @@ -808,16 +811,18 @@ def case_to_incident_escalate_flow(
)
)

title = title if title else case.title

description = (
f"{incident_description if incident_description else case.description}\n\n"
f"This incident was the result of escalating case {case.name} "
f"in the {case.project.name} project. Check out the case in the Dispatch Web UI for additional context."
)

incident_priority = case.case_priority if not incident_priority else incident_priority
incident_priority = incident_priority if incident_priority else case.case_priority

incident_in = IncidentCreate(
title=case.title,
title=title,
description=description,
status=IncidentStatus.active,
incident_type=incident_type,
Expand Down
3 changes: 2 additions & 1 deletion src/dispatch/plugins/dispatch_slack/case/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,11 +1268,12 @@ def handle_escalation_submission_event(
name=form_data[DefaultBlockIds.incident_priority_select]["name"],
)
incident_description = form_data.get(DefaultBlockIds.description_input, case.description)

title = form_data.get(DefaultBlockIds.title_input, case.title)
case_flows.case_escalated_status_flow(
case=case,
organization_slug=context["subject"].organization_slug,
db_session=db_session,
title=title,
incident_priority=incident_priority,
incident_type=incident_type,
incident_description=incident_description,
Expand Down

0 comments on commit 1cb1451

Please sign in to comment.