app/soc/logic/models/notification.py
changeset 997 d4ba019f1f8b
parent 819 08a79c3e8817
child 1106 e14b0995cf29
--- a/app/soc/logic/models/notification.py	Sun Jan 25 22:42:09 2009 +0000
+++ b/app/soc/logic/models/notification.py	Sun Jan 25 23:35:39 2009 +0000
@@ -24,6 +24,7 @@
 
 from google.appengine.ext import db
 
+from soc.cache import sidebar
 from soc.logic.helper import notifications
 from soc.logic.models import base
 from soc.logic.models import user as user_logic
@@ -57,5 +58,18 @@
       # there is only one unread notification so send out an email
       notifications.sendNewNotificationMessage(entity)
 
+    # flush the sidebar cache
+    sidebar.flush(entity.scope.account)
+
+  def _updateField(self, entity, name, value):
+    """If unread changes we flush the sidebar cache.
+    """
+
+    if (name == 'unread') and (entity.unread != value):
+      # in case that the unread value changes we flush the sidebar.
+      sidebar.flush(entity.scope.account)
+
+    return True
+
 
 logic = Logic()