Mercurial > kallithea
comparison rhodecode/controllers/admin/notifications.py @ 2503:d04243e932cc beta
Added filtering on inbox by comments
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 25 Jun 2012 22:40:04 +0200 |
parents | 74f2910f7ad9 |
children | f8742e1acf08 |
comparison
equal
deleted
inserted
replaced
2502:9374eecac156 | 2503:d04243e932cc |
---|---|
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 filter_=request.GET.getall('type')) |
65 p = int(request.params.get('page', 1)) | 65 p = int(request.params.get('page', 1)) |
66 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 | 67 c.pull_request_type = Notification.TYPE_PULL_REQUEST |
68 c.comment_type = [Notification.TYPE_CHANGESET_COMMENT, | |
69 Notification.TYPE_PULL_REQUEST_COMMENT] | |
68 return render('admin/notifications/notifications.html') | 70 return render('admin/notifications/notifications.html') |
69 | 71 |
70 def mark_all_read(self): | 72 def mark_all_read(self): |
71 if request.environ.get('HTTP_X_PARTIAL_XHR'): | 73 if request.environ.get('HTTP_X_PARTIAL_XHR'): |
72 nm = NotificationModel() | 74 nm = NotificationModel() |
73 # mark all read | 75 # mark all read |
74 nm.mark_all_read_for_user(self.rhodecode_user.user_id, | 76 nm.mark_all_read_for_user(self.rhodecode_user.user_id, |
75 filter_=request.GET) | 77 filter_=request.GET.getall('type')) |
76 Session.commit() | 78 Session.commit() |
77 c.user = self.rhodecode_user | 79 c.user = self.rhodecode_user |
78 notif = nm.get_for_user(self.rhodecode_user.user_id, | 80 notif = nm.get_for_user(self.rhodecode_user.user_id, |
79 filter_=request.GET) | 81 filter_=request.GET.getall('type')) |
80 c.notifications = Page(notif, page=1, items_per_page=10) | 82 c.notifications = Page(notif, page=1, items_per_page=10) |
81 return render('admin/notifications/notifications_data.html') | 83 return render('admin/notifications/notifications_data.html') |
82 | 84 |
83 def create(self): | 85 def create(self): |
84 """POST /_admin/notifications: Create a new item""" | 86 """POST /_admin/notifications: Create a new item""" |