diff options
| author | Frederic Guillot <fred@kanboard.net> | 2017-03-11 19:01:40 -0500 | 
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2017-03-11 19:01:40 -0500 | 
| commit | cfd3000d833d3a99df0b4248e3b6160e9be4f22a (patch) | |
| tree | 2a4ccff357a394670a49fd4447f3ebaee637b667 /app/Controller/WebNotificationController.php | |
| parent | bb9e7916574bd7e21550bf7505757fccae6cbdd0 (diff) | |
Move notifications outside of dashboard
Diffstat (limited to 'app/Controller/WebNotificationController.php')
| -rw-r--r-- | app/Controller/WebNotificationController.php | 29 | 
1 files changed, 22 insertions, 7 deletions
| 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 @@ -11,16 +11,32 @@ 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       *       * @access public       */      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', | 
