From 4e78a0aceda217a16d4894f10f36e0a77bc221c5 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 29 Jan 2017 20:06:32 -0500 Subject: Do not set default task assignee for team projects --- app/Controller/TaskBulkController.php | 2 +- app/Controller/TaskCreationController.php | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/Controller/TaskBulkController.php b/app/Controller/TaskBulkController.php index 51447f32..4345a68f 100644 --- a/app/Controller/TaskBulkController.php +++ b/app/Controller/TaskBulkController.php @@ -32,7 +32,7 @@ class TaskBulkController extends BaseController 'project' => $project, 'values' => $values, 'errors' => $errors, - 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, $project['is_private']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, $project['is_private'] == 1), 'colors_list' => $this->colorModel->getList(), 'categories_list' => $this->categoryModel->getList($project['id']), ))); diff --git a/app/Controller/TaskCreationController.php b/app/Controller/TaskCreationController.php index cafd7e06..faf2d250 100644 --- a/app/Controller/TaskCreationController.php +++ b/app/Controller/TaskCreationController.php @@ -23,8 +23,8 @@ class TaskCreationController extends BaseController public function show(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $swimlanes_list = $this->swimlaneModel->getList($project['id'], false, true); - $values += $this->prepareValues($swimlanes_list); + $swimlanesList = $this->swimlaneModel->getList($project['id'], false, true); + $values += $this->prepareValues($project['is_private'], $swimlanesList); $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); $values = $this->hook->merge('controller:task-creation:form:default', $values, array('default_values' => $values)); @@ -34,9 +34,9 @@ class TaskCreationController extends BaseController 'errors' => $errors, 'values' => $values + array('project_id' => $project['id']), 'columns_list' => $this->columnModel->getList($project['id']), - 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, $project['is_private']), + 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, $project['is_private'] == 1), 'categories_list' => $this->categoryModel->getList($project['id']), - 'swimlanes_list' => $swimlanes_list, + 'swimlanes_list' => $swimlanesList, ))); } @@ -113,18 +113,22 @@ class TaskCreationController extends BaseController * Prepare form values * * @access protected - * @param array $swimlanes_list + * @param bool $isPrivateProject + * @param array $swimlanesList * @return array */ - protected function prepareValues(array $swimlanes_list) + protected function prepareValues($isPrivateProject, array $swimlanesList) { $values = array( - 'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)), + 'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanesList)), 'column_id' => $this->request->getIntegerParam('column_id'), 'color_id' => $this->colorModel->getDefaultColor(), - 'owner_id' => $this->userSession->getId(), ); + if ($isPrivateProject) { + $values['owner_id'] = $this->userSession->getId(); + } + return $values; } -- cgit v1.2.3