From 00a4d1cb9fa33c1518a191764337493e0b453249 Mon Sep 17 00:00:00 2001 From: Tom Withers Date: Fri, 18 Dec 2020 14:02:41 +0000 Subject: [PATCH] Import the standard response notifications (#66) --- .../actions/incident_notifications.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/opgincidentresponse/actions/incident_notifications.py b/opgincidentresponse/actions/incident_notifications.py index c47cd56..a894d9d 100644 --- a/opgincidentresponse/actions/incident_notifications.py +++ b/opgincidentresponse/actions/incident_notifications.py @@ -1,14 +1,20 @@ from response.core.models import Incident from response.slack.models import CommsChannel from response.slack.decorators import recurring_notification, single_notification - +from response.slack import incident_notifications @single_notification() def incident_response_process(incident: Incident): - comms_channel = CommsChannel.objects.get(incident=incident) - comms_channel.post_in_channel("📗 You can find our Incident Response process here https://ministryofjustice.github.io/opg-technical-guidance/incidents/incident-response-process/#incident-response-process") + try: + comms_channel = CommsChannel.objects.get(incident=incident) + comms_channel.post_in_channel("📗 You can find our Incident Response process here https://ministryofjustice.github.io/opg-technical-guidance/incidents/incident-response-process/#incident-response-process") + except CommsChannel.DoesNotExist: + pass @recurring_notification(interval_mins=30, max_notifications=10) def take_a_break(incident: Incident): - comms_channel = CommsChannel.objects.get(incident=incident) - comms_channel.post_in_channel("👋 30 minutes have elapsed. Think about taking a few minutes away from the screen.") + try: + comms_channel = CommsChannel.objects.get(incident=incident) + comms_channel.post_in_channel("👋 30 minutes have elapsed. Think about taking a few minutes away from the screen.") + except CommsChannel.DoesNotExist: + pass \ No newline at end of file