diff options
Diffstat (limited to 'app/Formatter')
-rw-r--r-- | app/Formatter/TaskListSubtaskAssigneeFormatter.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/Formatter/TaskListSubtaskAssigneeFormatter.php b/app/Formatter/TaskListSubtaskAssigneeFormatter.php index 50b08cd8..73391766 100644 --- a/app/Formatter/TaskListSubtaskAssigneeFormatter.php +++ b/app/Formatter/TaskListSubtaskAssigneeFormatter.php @@ -11,6 +11,7 @@ namespace Kanboard\Formatter; class TaskListSubtaskAssigneeFormatter extends TaskListFormatter { protected $userId = 0; + protected $withoutEmptyTasks = false; /** * Set assignee @@ -24,6 +25,12 @@ class TaskListSubtaskAssigneeFormatter extends TaskListFormatter return $this; } + public function withoutEmptyTasks() + { + $this->withoutEmptyTasks = true; + return $this; + } + /** * Apply formatter * @@ -38,6 +45,12 @@ class TaskListSubtaskAssigneeFormatter extends TaskListFormatter $subtasks = array_column_index($subtasks, 'task_id'); array_merge_relation($tasks, $subtasks, 'subtasks', 'id'); + if ($this->withoutEmptyTasks) { + $tasks = array_filter($tasks, function (array $task) { + return count($task['subtasks']) > 0; + }); + } + return $tasks; } } |