Skip to content

Commit

Permalink
Fixes the engage-oncall command when page is not selected (#3262)
Browse files Browse the repository at this point in the history
  • Loading branch information
wssheldon committed Apr 11, 2023
1 parent 7c5e33f commit 326c858
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/dispatch/plugins/dispatch_slack/incident/interactive.py
Expand Up @@ -1428,10 +1428,28 @@ def handle_engage_oncall_submission_event(
form_data: dict,
user: DispatchUser,
) -> None:
"""Handles the engage oncall submission"""
"""Handles the engage oncall submission.
Notes:
If the page checkbox is checked, form_data will contain the `engage-oncall-page` key. For example:
"engage-oncall-service": {
"name": "Security Incident Response Team (SIRT) - TEST",
"value": "1337WOW",
},
"engage-oncall-page": [{"name": "Page", "value": "Yes"}],
Otherwise, the `engage-oncall-page` key is omitted. For example:
"engage-oncall-service": {
"name": "Security Incident Response Team (SIRT)",
"value": "1337WOW",
}
"""
ack_engage_oncall_submission_event(ack=ack)
oncall_service_external_id = form_data[EngageOncallBlockIds.service]["value"]
page = form_data.get(EngageOncallBlockIds.page, {"value": None})[0]["value"]
page_block = form_data.get(EngageOncallBlockIds.page)
page = page_block[0]["value"] if page_block else None # page_block[0]["value"] == "Yes"

oncall_individual, oncall_service = incident_flows.incident_engage_oncall_flow(
user.email,
Expand Down

0 comments on commit 326c858

Please sign in to comment.