diff rhodecode/controllers/admin/notifications.py @ 2433:74f2910f7ad9 codereview

Added pull requests filter into notification inbox. - Mark all read now also marks only filtered results
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 10 Jun 2012 00:08:29 +0200
parents 64f7cf8f6a33
children d04243e932cc
line wrap: on
line diff
--- a/rhodecode/controllers/admin/notifications.py	Sat Jun 09 20:23:48 2012 +0200
+++ b/rhodecode/controllers/admin/notifications.py	Sun Jun 10 00:08:29 2012 +0200
@@ -60,19 +60,23 @@
         """GET /_admin/notifications: All items in the collection"""
         # url('notifications')
         c.user = self.rhodecode_user
-        notif = NotificationModel().get_for_user(self.rhodecode_user.user_id)
+        notif = NotificationModel().get_for_user(self.rhodecode_user.user_id,
+                                                 filter_=request.GET)
         p = int(request.params.get('page', 1))
         c.notifications = Page(notif, page=p, items_per_page=10)
+        c.pull_request_type = Notification.TYPE_PULL_REQUEST
         return render('admin/notifications/notifications.html')
 
     def mark_all_read(self):
         if request.environ.get('HTTP_X_PARTIAL_XHR'):
             nm = NotificationModel()
             # mark all read
-            nm.mark_all_read_for_user(self.rhodecode_user.user_id)
+            nm.mark_all_read_for_user(self.rhodecode_user.user_id,
+                                      filter_=request.GET)
             Session.commit()
             c.user = self.rhodecode_user
-            notif = nm.get_for_user(self.rhodecode_user.user_id)
+            notif = nm.get_for_user(self.rhodecode_user.user_id,
+                                    filter_=request.GET)
             c.notifications = Page(notif, page=1, items_per_page=10)
             return render('admin/notifications/notifications_data.html')