From 239aa42649341819d65310c0d9c7a342542e3b68 Mon Sep 17 00:00:00 2001
From: Jorran de Wit <jorrandewit@outlook.com>
Date: Mon, 9 Oct 2017 07:40:58 +0200
Subject: [PATCH] Fix unassigned streams can receive events

---
 production/signals.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/production/signals.py b/production/signals.py
index 31327d531..a7dd1c71d 100644
--- a/production/signals.py
+++ b/production/signals.py
@@ -31,12 +31,12 @@ def notify_new_event(sender, instance, created, **kwargs):
     if created:
         stream = instance.stream
 
-        if stream.officer != instance.noted_by:
+        if stream.officer and stream.officer != instance.noted_by:
             notify.send(sender=sender, recipient=stream.officer.user,
                         actor=instance.noted_by.user,
                         verb=' created a new Production Event.', target=instance)
 
-        if stream.supervisor != instance.noted_by:
+        if stream.supervisor and stream.supervisor != instance.noted_by:
             notify.send(sender=sender, recipient=stream.supervisor.user,
                         actor=instance.noted_by.user,
                         verb=' created a new Production Event.', target=instance)
-- 
GitLab