Add quick link assign me in different views
This commit is contained in:
@@ -14,6 +14,19 @@ use Kanboard\Core\ExternalTask\ExternalTaskException;
|
||||
*/
|
||||
class TaskModificationController extends BaseController
|
||||
{
|
||||
public function assignToMe()
|
||||
{
|
||||
$task = $this->getTask();
|
||||
$values = ['id' => $task['id'], 'owner_id' => $this->userSession->getId()];
|
||||
|
||||
if (! $this->helper->projectRole->canUpdateTask($task)) {
|
||||
throw new AccessForbiddenException(t('You are not allowed to update tasks assigned to someone else.'));
|
||||
}
|
||||
|
||||
$this->taskModificationModel->update($values);
|
||||
$this->redirectAfterQuickAction($task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the start date automatically
|
||||
*
|
||||
@@ -22,12 +35,34 @@ class TaskModificationController extends BaseController
|
||||
public function start()
|
||||
{
|
||||
$task = $this->getTask();
|
||||
$values = array('id' => $task['id'], 'date_started' => time());
|
||||
$values = ['id' => $task['id'], 'date_started' => time()];
|
||||
|
||||
if (! $this->helper->projectRole->canUpdateTask($task)) {
|
||||
throw new AccessForbiddenException(t('You are not allowed to update tasks assigned to someone else.'));
|
||||
}
|
||||
|
||||
$this->taskModificationModel->update($values);
|
||||
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
|
||||
$this->redirectAfterQuickAction($task);
|
||||
}
|
||||
|
||||
protected function redirectAfterQuickAction(array $task)
|
||||
{
|
||||
switch ($this->request->getStringParam('redirect')) {
|
||||
case 'board':
|
||||
$this->response->redirect($this->helper->url->to('BoardViewController', 'show', ['project_id' => $task['project_id']]));
|
||||
break;
|
||||
case 'list':
|
||||
$this->response->redirect($this->helper->url->to('TaskListController', 'show', ['project_id' => $task['project_id']]));
|
||||
break;
|
||||
case 'dashboard':
|
||||
$this->response->redirect($this->helper->url->to('DashboardController', 'show', [], 'project-tasks-'.$task['project_id']));
|
||||
break;
|
||||
case 'dashboard-tasks':
|
||||
$this->response->redirect($this->helper->url->to('DashboardController', 'tasks', ['user_id' => $this->userSession->getId()]));
|
||||
break;
|
||||
default:
|
||||
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', ['project_id' => $task['project_id'], 'task_id' => $task['id']]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user