diff 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
line wrap: on
line diff
--- a/rhodecode/model/notification.py	Mon Dec 19 00:12:50 2011 +0200
+++ b/rhodecode/model/notification.py	Mon Dec 19 02:31:22 2011 +0200
@@ -134,6 +134,12 @@
         user = self.__get_user(user)
         return user.notifications
 
+    def mark_all_read_for_user(self, user):
+        user = self.__get_user(user)
+        UserNotification.query()\
+            .filter(UserNotification.read==False)\
+            .update({'read': True})
+
     def get_unread_cnt_for_user(self, user):
         user = self.__get_user(user)
         return UserNotification.query()\