From cfd3000d833d3a99df0b4248e3b6160e9be4f22a Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 11 Mar 2017 19:01:40 -0500 Subject: Move notifications outside of dashboard --- app/Controller/WebNotificationController.php | 29 +++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'app/Controller/WebNotificationController.php') diff --git a/app/Controller/WebNotificationController.php b/app/Controller/WebNotificationController.php index 30e317f8..02827ab5 100644 --- a/app/Controller/WebNotificationController.php +++ b/app/Controller/WebNotificationController.php @@ -10,6 +10,23 @@ namespace Kanboard\Controller; */ class WebNotificationController extends BaseController { + /** + * My notifications + * + * @access public + */ + public function show() + { + $user = $this->getUser(); + $notifications = $this->userUnreadNotificationModel->getAll($user['id']); + + $this->response->html($this->template->render('web_notification/show', array( + 'notifications' => $notifications, + 'nb_notifications' => count($notifications), + 'user' => $user, + ))); + } + /** * Mark all notifications as read * @@ -17,10 +34,9 @@ class WebNotificationController extends BaseController */ public function flush() { - $user_id = $this->getUserId(); - - $this->userUnreadNotificationModel->markAllAsRead($user_id); - $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); + $userId = $this->getUserId(); + $this->userUnreadNotificationModel->markAllAsRead($userId); + $this->show(); } /** @@ -32,9 +48,8 @@ class WebNotificationController extends BaseController { $user_id = $this->getUserId(); $notification_id = $this->request->getIntegerParam('notification_id'); - $this->userUnreadNotificationModel->markAsRead($user_id, $notification_id); - $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); + $this->show(); } /** @@ -49,7 +64,7 @@ class WebNotificationController extends BaseController $this->userUnreadNotificationModel->markAsRead($user_id, $notification_id); if (empty($notification)) { - $this->response->redirect($this->helper->url->to('DashboardController', 'notifications', array('user_id' => $user_id))); + $this->show(); } elseif ($this->helper->text->contains($notification['event_name'], 'comment')) { $this->response->redirect($this->helper->url->to( 'TaskViewController', -- cgit v1.2.3