Added flushing the sidebar when dealing with notifications.
On request from Pawel Solyga.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- 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()