diff options
Diffstat (limited to 'app/Controller/CommentController.php')
-rw-r--r-- | app/Controller/CommentController.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/app/Controller/CommentController.php b/app/Controller/CommentController.php index 526bd2bf..9a89103e 100644 --- a/app/Controller/CommentController.php +++ b/app/Controller/CommentController.php @@ -4,7 +4,6 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Controller\PageNotFoundException; -use Kanboard\Model\UserMetadataModel; /** * Comment Controller @@ -17,12 +16,12 @@ class CommentController extends BaseController /** * Get the current comment * - * @access private + * @access protected * @return array * @throws PageNotFoundException * @throws AccessForbiddenException */ - private function getComment() + protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); @@ -77,6 +76,8 @@ class CommentController extends BaseController { $task = $this->getTask(); $values = $this->request->getValues(); + $values['task_id'] = $task['id']; + $values['user_id'] = $this->userSession->getId(); list($valid, $errors) = $this->commentValidator->validateCreation($values); @@ -118,7 +119,6 @@ class CommentController extends BaseController 'errors' => $errors, 'comment' => $comment, 'task' => $task, - 'title' => t('Edit a comment') ))); } @@ -142,10 +142,11 @@ class CommentController extends BaseController $this->flash->failure(t('Unable to update your comment.')); } - return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), false); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return; } - return $this->edit($values, $errors); + $this->edit($values, $errors); } /** @@ -182,7 +183,7 @@ class CommentController extends BaseController $this->flash->failure(t('Unable to remove this comment.')); } - $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments')); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true); } /** @@ -193,11 +194,7 @@ class CommentController extends BaseController public function toggleSorting() { $task = $this->getTask(); - - $oldDirection = $this->userMetadataCacheDecorator->get(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, 'ASC'); - $newDirection = $oldDirection === 'ASC' ? 'DESC' : 'ASC'; - - $this->userMetadataCacheDecorator->set(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, $newDirection); + $this->helper->comment->toggleSorting(); $this->response->redirect($this->helper->url->to( 'TaskViewController', |