From 3880b257054cebcce9f55528bbc41e7071684922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20R=C3=B6hrl?= Date: Fri, 21 Aug 2020 13:56:58 +0200 Subject: [PATCH] show in dashboard and overview all my assigned cards and on private boards all due cards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakob Röhrl --- lib/Service/OverviewService.php | 29 +++++++++++++++------ src/components/navigation/AppNavigation.vue | 4 +-- src/components/overview/Overview.vue | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/Service/OverviewService.php b/lib/Service/OverviewService.php index fc0168c82..88c97b9c6 100644 --- a/lib/Service/OverviewService.php +++ b/lib/Service/OverviewService.php @@ -109,17 +109,30 @@ class OverviewService { public function findAssignedCards(string $userId): array { $userBoards = $this->findAllBoardsFromUser($userId); - $allAssignedCards = []; + $findCards = []; foreach ($userBoards as $userBoard) { $service = $this; - $allAssignedCards[] = array_map(static function ($card) use ($service, $userBoard, $userId) { - $service->enrich($card, $userId); - $cardData = $card->jsonSerialize(); - $cardData['boardId'] = $userBoard->getId(); - return $cardData; - }, $this->cardMapper->findAssignedCards($userBoard->getId(), $userId)); + + if (count($userBoard->getAcl()) == 0) { + // get cards with due date + $findCards[] = array_map(static function ($card) use ($service, $userBoard, $userId) { + $service->enrich($card, $userId); + $cardData = $card->jsonSerialize(); + $cardData['boardId'] = $userBoard->getId(); + return $cardData; + }, $this->cardMapper->findAllWithDue($userBoard->getId())); + } else { + // get assigned cards + $findCards[] = array_map(static function ($card) use ($service, $userBoard, $userId) { + $service->enrich($card, $userId); + $cardData = $card->jsonSerialize(); + $cardData['boardId'] = $userBoard->getId(); + return $cardData; + }, $this->cardMapper->findAssignedCards($userBoard->getId(), $userId)); + } + } - return $allAssignedCards; + return $findCards; } // FIXME: This is duplicate code with the board service diff --git a/src/components/navigation/AppNavigation.vue b/src/components/navigation/AppNavigation.vue index c1c58f849..5c579e43c 100644 --- a/src/components/navigation/AppNavigation.vue +++ b/src/components/navigation/AppNavigation.vue @@ -24,8 +24,8 @@