app/soc/logic/models/notification.py
changeset 997 d4ba019f1f8b
parent 819 08a79c3e8817
child 1106 e14b0995cf29
equal deleted inserted replaced
996:a6f67d4c297f 997:d4ba019f1f8b
    22   ]
    22   ]
    23 
    23 
    24 
    24 
    25 from google.appengine.ext import db
    25 from google.appengine.ext import db
    26 
    26 
       
    27 from soc.cache import sidebar
    27 from soc.logic.helper import notifications
    28 from soc.logic.helper import notifications
    28 from soc.logic.models import base
    29 from soc.logic.models import base
    29 from soc.logic.models import user as user_logic
    30 from soc.logic.models import user as user_logic
    30 
    31 
    31 import soc.models.notification
    32 import soc.models.notification
    55 
    56 
    56     if unread_count == 1:
    57     if unread_count == 1:
    57       # there is only one unread notification so send out an email
    58       # there is only one unread notification so send out an email
    58       notifications.sendNewNotificationMessage(entity)
    59       notifications.sendNewNotificationMessage(entity)
    59 
    60 
       
    61     # flush the sidebar cache
       
    62     sidebar.flush(entity.scope.account)
       
    63 
       
    64   def _updateField(self, entity, name, value):
       
    65     """If unread changes we flush the sidebar cache.
       
    66     """
       
    67 
       
    68     if (name == 'unread') and (entity.unread != value):
       
    69       # in case that the unread value changes we flush the sidebar.
       
    70       sidebar.flush(entity.scope.account)
       
    71 
       
    72     return True
       
    73 
    60 
    74 
    61 logic = Logic()
    75 logic = Logic()