From 7e7f222032deaa3270d7ea18f9b347a61e5b321c Mon Sep 17 00:00:00 2001 From: Sylvia McLaughlin <85905333+sylviamclaughlin@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:21:25 +0000 Subject: [PATCH 1/2] Adding functionality to handle situation where the app_unfurl does not exist --- app/commands/incident.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/commands/incident.py b/app/commands/incident.py index 0752896d..7201e0dd 100644 --- a/app/commands/incident.py +++ b/app/commands/incident.py @@ -37,8 +37,9 @@ def handle_incident_action_buttons(client, ack, body, logger): f"<@{user}> a pris connaissance et ignoré l'incident." ) # if the last attachment is a preview from a link, switch the places of the last 2 attachments so that the incident buttons can be appended properly - if len(attachments) > 1 and attachments[-1]["app_unfurl_url"]: - attachments[-2], attachments[-1] = attachments[-1], attachments[-2] + if len(attachments) > 1: + if "app_unfurl_url" in attachments[-1]: + attachments[-2], attachments[-1] = attachments[-1], attachments[-2] attachments[-1] = { "color": "3AA3E3", "fallback": f"{msg}", @@ -328,6 +329,9 @@ def submit(ack, view, say, body, client, logger): text = "Run `/sre incident roles` to assign roles to the incident" say(text=text, channel=channel_id) + # Announce how we can update the status of an incident + text = "Run `/sre incident status` to update the status of the incident and to close the incident" + def generate_success_modal(body): locale = body["view"]["blocks"][0]["elements"][0]["value"] From 3d23ff4dce322c1d8dd4a7e54628e863a7b0b412 Mon Sep 17 00:00:00 2001 From: Sylvia McLaughlin <85905333+sylviamclaughlin@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:26:04 +0000 Subject: [PATCH 2/2] Removing unnedded print statement --- app/commands/incident.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/commands/incident.py b/app/commands/incident.py index 7201e0dd..77d6f62b 100644 --- a/app/commands/incident.py +++ b/app/commands/incident.py @@ -329,9 +329,6 @@ def submit(ack, view, say, body, client, logger): text = "Run `/sre incident roles` to assign roles to the incident" say(text=text, channel=channel_id) - # Announce how we can update the status of an incident - text = "Run `/sre incident status` to update the status of the incident and to close the incident" - def generate_success_modal(body): locale = body["view"]["blocks"][0]["elements"][0]["value"]