do not send notifications after desactivation
authorraph
Fri, 11 Dec 2009 10:41:08 +0100
changeset 53 3be33d57ab11
parent 52 9fa013909d9a
child 54 d59a1c867dd4
do not send notifications after desactivation
src/cm/notifications.py
--- a/src/cm/notifications.py	Fri Dec 11 10:29:11 2009 +0100
+++ b/src/cm/notifications.py	Fri Dec 11 10:41:08 2009 +0100
@@ -21,7 +21,7 @@
     
     activity = kwargs['instance']
     if activity.type in Activity.VIEWABLE_ACTIVITIES.get('view_users'): # user activity: only viewed by managers
-        notifications = Notification.objects.filter(text=None)
+        notifications = Notification.objects.filter(text=None, active=True)
         for notification in notifications:
             if notification.user:
                 from cm.security import user_has_perm # import here!
@@ -29,7 +29,7 @@
                     send_notification(activity, notification)
                     allready_notified.add(notification.user)
     elif activity.type in Activity.VIEWABLE_ACTIVITIES.get('view_comments'):
-        notifications = Notification.objects.filter(Q(text=activity.text) | Q(text=None))
+        notifications = Notification.objects.filter(Q(text=activity.text) | Q(text=None), active=True)
         for notification in notifications:            
             viewable = get_viewable_comments(FakeRequest(notification.user),
                                              Comment.objects.filter(id__in = [activity.comment.id]),
@@ -41,7 +41,7 @@
                     send_notification(activity, notification)
                     allready_notified.add(notification.user)            
     elif activity.type in Activity.VIEWABLE_ACTIVITIES.get('view_texts'):
-        notifications = Notification.objects.filter(Q(text=activity.text) | Q(text=None))
+        notifications = Notification.objects.filter(Q(text=activity.text) | Q(text=None), active=True)
         for notification in notifications:
             if notification.user:
                 from cm.security import user_has_perm # import here!