comparison rhodecode/model/notification.py @ 1791:2aee0dc1784e beta

mark all read button for notifications
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 19 Dec 2011 02:31:22 +0200
parents 025f3333c769
children 6c86c987cf93
comparison
equal deleted inserted replaced
1790:f551007ce085 1791:2aee0dc1784e
132 132
133 def get_for_user(self, user): 133 def get_for_user(self, user):
134 user = self.__get_user(user) 134 user = self.__get_user(user)
135 return user.notifications 135 return user.notifications
136 136
137 def mark_all_read_for_user(self, user):
138 user = self.__get_user(user)
139 UserNotification.query()\
140 .filter(UserNotification.read==False)\
141 .update({'read': True})
142
137 def get_unread_cnt_for_user(self, user): 143 def get_unread_cnt_for_user(self, user):
138 user = self.__get_user(user) 144 user = self.__get_user(user)
139 return UserNotification.query()\ 145 return UserNotification.query()\
140 .filter(UserNotification.read == False)\ 146 .filter(UserNotification.read == False)\
141 .filter(UserNotification.user == user).count() 147 .filter(UserNotification.user == user).count()