Mercurial > kallithea
comparison 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 |
comparison
equal
deleted
inserted
replaced
2432:d3ac7491a5c8 | 2433:74f2910f7ad9 |
---|---|
58 | 58 |
59 def index(self, format='html'): | 59 def index(self, format='html'): |
60 """GET /_admin/notifications: All items in the collection""" | 60 """GET /_admin/notifications: All items in the collection""" |
61 # url('notifications') | 61 # url('notifications') |
62 c.user = self.rhodecode_user | 62 c.user = self.rhodecode_user |
63 notif = NotificationModel().get_for_user(self.rhodecode_user.user_id) | 63 notif = NotificationModel().get_for_user(self.rhodecode_user.user_id, |
64 filter_=request.GET) | |
64 p = int(request.params.get('page', 1)) | 65 p = int(request.params.get('page', 1)) |
65 c.notifications = Page(notif, page=p, items_per_page=10) | 66 c.notifications = Page(notif, page=p, items_per_page=10) |
67 c.pull_request_type = Notification.TYPE_PULL_REQUEST | |
66 return render('admin/notifications/notifications.html') | 68 return render('admin/notifications/notifications.html') |
67 | 69 |
68 def mark_all_read(self): | 70 def mark_all_read(self): |
69 if request.environ.get('HTTP_X_PARTIAL_XHR'): | 71 if request.environ.get('HTTP_X_PARTIAL_XHR'): |
70 nm = NotificationModel() | 72 nm = NotificationModel() |
71 # mark all read | 73 # mark all read |
72 nm.mark_all_read_for_user(self.rhodecode_user.user_id) | 74 nm.mark_all_read_for_user(self.rhodecode_user.user_id, |
75 filter_=request.GET) | |
73 Session.commit() | 76 Session.commit() |
74 c.user = self.rhodecode_user | 77 c.user = self.rhodecode_user |
75 notif = nm.get_for_user(self.rhodecode_user.user_id) | 78 notif = nm.get_for_user(self.rhodecode_user.user_id, |
79 filter_=request.GET) | |
76 c.notifications = Page(notif, page=1, items_per_page=10) | 80 c.notifications = Page(notif, page=1, items_per_page=10) |
77 return render('admin/notifications/notifications_data.html') | 81 return render('admin/notifications/notifications_data.html') |
78 | 82 |
79 def create(self): | 83 def create(self): |
80 """POST /_admin/notifications: Create a new item""" | 84 """POST /_admin/notifications: Create a new item""" |