Remove project_id from task URLs

This commit is contained in:
Tomas Dittmann
2022-02-05 05:59:33 +01:00
committed by GitHub
parent 2150ca73b9
commit 61e63ef9e0
97 changed files with 209 additions and 219 deletions

View File

@@ -24,15 +24,12 @@ class CommentController extends BaseController
*/
public function create(array $values = array(), array $errors = array())
{
$project = $this->getProject();
$task = $this->getTask();
$values['project_id'] = $task['project_id'];
$this->response->html($this->helper->layout->task('comment/create', array(
'values' => $values,
'errors' => $errors,
'task' => $task,
'project' => $project,
'task' => $task
)));
}
@@ -57,7 +54,7 @@ class CommentController extends BaseController
$this->flash->failure(t('Unable to create your comment.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id']), 'comments'), true);
} else {
$this->create($values, $errors);
}
@@ -81,8 +78,6 @@ class CommentController extends BaseController
$values = $comment;
}
$values['project_id'] = $task['project_id'];
$this->response->html($this->template->render('comment/edit', array(
'values' => $values,
'errors' => $errors,
@@ -115,7 +110,7 @@ class CommentController extends BaseController
$this->flash->failure(t('Unable to update your comment.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
return;
}
@@ -156,7 +151,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'), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id']), 'comments'), true);
}
/**
@@ -173,7 +168,7 @@ class CommentController extends BaseController
$this->response->redirect($this->helper->url->to(
'TaskViewController',
'show',
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
array('task_id' => $task['id']),
'comments'
));
}

View File

@@ -12,15 +12,13 @@ class CommentMailController extends BaseController
{
public function create(array $values = array(), array $errors = array())
{
$project = $this->getProject();
$task = $this->getTask();
$this->response->html($this->helper->layout->task('comment_mail/create', array(
'values' => $values,
'errors' => $errors,
'task' => $task,
'project' => $project,
'members' => $this->projectPermissionModel->getMembersWithEmail($project['id']),
'members' => $this->projectPermissionModel->getMembersWithEmail($task['project_id']),
)));
}
@@ -43,7 +41,7 @@ class CommentMailController extends BaseController
$this->flash->failure(t('Unable to create your comment.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id']), 'comments'), true);
} else {
$this->create($values, $errors);
}

View File

@@ -91,7 +91,7 @@ class ExternalTaskCreationController extends BaseController
} else {
$taskId = $this->taskCreationModel->create($values);
$this->flash->success(t('Task created successfully.'));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $project['id'], 'task_id' => $taskId)), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $taskId)), true);
}
}
}

View File

@@ -37,7 +37,7 @@ class SubtaskController extends BaseController
'task' => $task,
)));
}
/**
* Prepare form values
*
@@ -86,7 +86,7 @@ class SubtaskController extends BaseController
if (! $this->subtaskModel->create($subtaskValues)) {
$this->flash->failure(t('Unable to create your sub-task.'));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id']), 'subtasks'), true);
return false;
}
@@ -110,7 +110,7 @@ class SubtaskController extends BaseController
}
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id']), 'subtasks'), true);
}
/**
@@ -160,7 +160,7 @@ class SubtaskController extends BaseController
$this->flash->failure(t('Unable to update your sub-task.'));
}
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
}
return $this->edit($values, $errors);
@@ -199,7 +199,7 @@ class SubtaskController extends BaseController
$this->flash->failure(t('Unable to remove this sub-task.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
}
/**

View File

@@ -23,11 +23,10 @@ class SubtaskConverterController extends BaseController
public function save()
{
$project = $this->getProject();
$task = $this->getTask();
$subtask = $this->getSubtask($task);
$task_id = $this->subtaskTaskConversionModel->convertToTask($project['id'], $subtask['id']);
$task_id = $this->subtaskTaskConversionModel->convertToTask($task['project_id'], $subtask['id']);
if ($task_id !== false) {
$this->flash->success(t('Subtask converted to task successfully.'));
@@ -35,6 +34,6 @@ class SubtaskConverterController extends BaseController
$this->flash->failure(t('Unable to convert the subtask.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $project['id'], 'task_id' => $task_id)), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task_id)), true);
}
}

View File

@@ -56,6 +56,6 @@ class SubtaskRestrictionController extends BaseController
'status' => SubtaskModel::STATUS_INPROGRESS,
));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
}
}

View File

@@ -25,10 +25,10 @@ class TaskDuplicationController extends BaseController
if ($task_id > 0) {
$this->flash->success(t('Task created successfully.'));
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task_id)));
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task_id)));
} else {
$this->flash->failure(t('Unable to create this task.'));
return $this->response->redirect($this->helper->url->to('TaskDuplicationController', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
return $this->response->redirect($this->helper->url->to('TaskDuplicationController', 'duplicate', array('task_id' => $task['id'])), true);
}
}
@@ -57,7 +57,7 @@ class TaskDuplicationController extends BaseController
$values['category_id'],
$values['owner_id'])) {
$this->flash->success(t('Task updated successfully.'));
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $values['project_id'], 'task_id' => $task['id'])));
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])));
}
$this->flash->failure(t('Unable to update your task.'));

View File

@@ -85,7 +85,7 @@ class TaskExternalLinkController extends BaseController
$this->flash->success(t('Unable to create your link.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
} else {
$provider = $this->externalLinkManager->getProvider($values['link_type']);
$this->response->html($this->template->render('task_external_link/create', array(
@@ -140,7 +140,7 @@ class TaskExternalLinkController extends BaseController
if ($valid && $this->taskExternalLinkModel->update($values)) {
$this->flash->success(t('Link updated successfully.'));
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
}
return $this->edit($values, $errors);
@@ -179,6 +179,6 @@ class TaskExternalLinkController extends BaseController
$this->flash->failure(t('Unable to remove this link.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])));
}
}

View File

@@ -21,7 +21,7 @@ class TaskFileController extends BaseController
if ($this->request->isPost() && $this->taskFileModel->uploadScreenshot($task['id'], $this->request->getValue('screenshot')) !== false) {
$this->flash->success(t('Screenshot uploaded successfully.'));
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
}
return $this->response->html($this->template->render('task_file/screenshot', array(
@@ -66,7 +66,7 @@ class TaskFileController extends BaseController
$this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
}
}
@@ -87,7 +87,7 @@ class TaskFileController extends BaseController
$this->flash->failure(t('Unable to remove this file.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])));
}
/**

View File

@@ -65,7 +65,7 @@ class TaskInternalLinkController extends BaseController
));
}
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
}
$errors = array('title' => array(t('The exact same link already exists')));
@@ -123,7 +123,7 @@ class TaskInternalLinkController extends BaseController
if ($valid) {
if ($this->taskLinkModel->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
$this->flash->success(t('Link updated successfully.'));
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links');
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])).'#links');
}
$this->flash->failure(t('Unable to update your link.'));
@@ -165,6 +165,6 @@ class TaskInternalLinkController extends BaseController
$this->flash->failure(t('Unable to remove this link.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])));
}
}

View File

@@ -12,15 +12,13 @@ class TaskMailController extends BaseController
{
public function create(array $values = array(), array $errors = array())
{
$project = $this->getProject();
$task = $this->getTask();
$this->response->html($this->helper->layout->task('task_mail/create', array(
'values' => $values,
'errors' => $errors,
'task' => $task,
'project' => $project,
'members' => $this->projectPermissionModel->getMembersWithEmail($project['id']),
'members' => $this->projectPermissionModel->getMembersWithEmail($task['project_id']),
)));
}
@@ -41,7 +39,7 @@ class TaskMailController extends BaseController
'task_id' => $task['id'],
));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id']), 'comments'), true);
} else {
$this->create($values, $errors);
}

View File

@@ -23,7 +23,7 @@ class TaskModificationController extends BaseController
if (! $this->helper->projectRole->canUpdateTask($task)) {
throw new AccessForbiddenException(t('You are not allowed to update tasks assigned to someone else.'));
}
if (! $this->helper->projectRole->canChangeAssignee($task)) {
throw new AccessForbiddenException(t('You are not allowed to change the assignee.'));
}
@@ -67,7 +67,7 @@ class TaskModificationController extends BaseController
$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']]));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', ['task_id' => $task['id']]));
}
}
@@ -146,7 +146,7 @@ class TaskModificationController extends BaseController
if ($valid && $this->updateTask($task, $values, $errors)) {
$this->flash->success(t('Task updated successfully.'));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
} else {
$this->flash->failure(t('Unable to update your task.'));
$this->edit($values, $errors);

View File

@@ -47,6 +47,6 @@ class TaskMovePositionController extends BaseController
$values['swimlane_id']
);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])));
}
}

View File

@@ -58,7 +58,7 @@ class TaskRecurrenceController extends BaseController
$this->flash->failure(t('Unable to update your task.'));
}
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
}
return $this->edit($values, $errors);

View File

@@ -52,7 +52,7 @@ class TaskStatusController extends BaseController
$this->flash->failure($failure_message);
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
} else {
$this->response->html($this->template->render($template, array(
'task' => $task,

View File

@@ -107,7 +107,7 @@ class TaskViewController extends BaseController
$task = $this->getTask();
$subtask_paginator = $this->paginator
->setUrl('TaskViewController', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'pagination' => 'subtasks'))
->setUrl('TaskViewController', 'timetracking', array('task_id' => $task['id'], 'pagination' => 'subtasks'))
->setMax(15)
->setOrder('start')
->setDirection('DESC')