summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-25 20:18:21 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-25 20:18:21 -0500
commit7731f00e29b36806af284ac2771b03e223da846a (patch)
tree2648bf244a25e0cbccad27ff10436e52017561c7 /app
parent37c6616e50dbce2a298a27513b9882bb105405b0 (diff)
Auto assign user during task creation if there is only one user
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Task.php2
-rw-r--r--app/Model/ProjectPermission.php7
2 files changed, 7 insertions, 2 deletions
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index 87e7b2f6..b826a305 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -101,7 +101,7 @@ class Task extends Base
),
'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE),
'columns_list' => $this->board->getColumnsList($project['id']),
- 'users_list' => $this->projectPermission->getMemberList($project['id']),
+ 'users_list' => $this->projectPermission->getMemberList($project['id'], true, false, true),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project['id']),
'date_format' => $this->config->get('application_date_format'),
diff --git a/app/Model/ProjectPermission.php b/app/Model/ProjectPermission.php
index faa4ba29..c890a94f 100644
--- a/app/Model/ProjectPermission.php
+++ b/app/Model/ProjectPermission.php
@@ -27,12 +27,17 @@ class ProjectPermission extends Base
* @param integer $project_id Project id
* @param bool $prepend_unassigned Prepend the 'Unassigned' value
* @param bool $prepend_everybody Prepend the 'Everbody' value
+ * @param bool $allow_single_user If there is only one user return only this user
* @return array
*/
- public function getMemberList($project_id, $prepend_unassigned = true, $prepend_everybody = false)
+ public function getMemberList($project_id, $prepend_unassigned = true, $prepend_everybody = false, $allow_single_user = false)
{
$allowed_users = $this->getMembers($project_id);
+ if ($allow_single_user && count($allowed_users) === 1) {
+ return $allowed_users;
+ }
+
if ($prepend_unassigned) {
$allowed_users = array(t('Unassigned')) + $allowed_users;
}