diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index f89616a10..2a3e6afbc 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -479,6 +479,12 @@ public function deleteAcl(int $id): ?Acl { /** * @param $id * @param $userId + * @param $withCards + * @param $withAssignments + * @param $withLabels + * @param $withDueDate + * @param $moveCardsToLeftStack + * @param $restoreArchivedCards * @return Board * @throws DoesNotExistException * @throws \OCA\Deck\NoPermissionException @@ -492,9 +498,9 @@ public function clone($id, $userId, $withCards = false, $withAssignments = false throw new NoPermissionException('Creating boards has been disabled for your account.'); } - $this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ); + $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ); - $board = $this->boardMapper->find($boardId); + $board = $this->boardMapper->find($id); $newBoard = new Board(); $newBoard->setTitle($board->getTitle() . ' (' . $this->l10n->t('copy') . ')'); $newBoard->setOwner($userId); @@ -518,7 +524,7 @@ public function clone($id, $userId, $withCards = false, $withAssignments = false } - $labels = $this->labelMapper->findAll($boardId); + $labels = $this->labelMapper->findAll($id); foreach ($labels as $label) { $newLabel = new Label(); $newLabel->setTitle($label->getTitle()); @@ -527,7 +533,7 @@ public function clone($id, $userId, $withCards = false, $withAssignments = false $this->labelMapper->insert($newLabel); } - $stacks = $this->stackMapper->findAll($boardId); + $stacks = $this->stackMapper->findAll($id); foreach ($stacks as $stack) { $newStack = new Stack(); $newStack->setTitle($stack->getTitle()); @@ -654,7 +660,7 @@ private function cloneCards(Board $board, Board $newBoard, bool $withAssignments }); $newStacks = $this->stackMapper->findAll($newBoard->getId()); - usort($stacks, function (Stack $a, Stack $b) { + usort($newStacks, function (Stack $a, Stack $b) { return $a->getOrder() - $b->getOrder(); }); @@ -670,6 +676,7 @@ private function cloneCards(Board $board, Board $newBoard, bool $withAssignments $targetStackId = $moveCardsToLeftStack ? $newStacks[0]->getId() : $newStacks[$i]->getId(); // Create a cloned card. + // Done with setters as only fields set via setters get written to db $newCard = new Card(); $newCard->setTitle($card->getTitle()); $newCard->setDescription($card->getDescription()); @@ -680,6 +687,7 @@ private function cloneCards(Board $board, Board $newBoard, bool $withAssignments $newCard->setDuedate($withDueDate ? $card->getDuedate() : null); $newCard->setArchived($restoreArchivedCards ? false : $card->getArchived()); $newCard->setStackId($targetStackId); + $newCard->setAssignedUsers($card->getAssignedUsers()); // Persist the cloned card. $newCard = $this->cardMapper->insert($newCard); diff --git a/src/components/navigation/AppNavigationBoard.vue b/src/components/navigation/AppNavigationBoard.vue index d38e450b2..1221ed576 100644 --- a/src/components/navigation/AppNavigationBoard.vue +++ b/src/components/navigation/AppNavigationBoard.vue @@ -270,7 +270,7 @@ export default { this.loading = false await this.$router.push({ name: 'board', params: { id: newBoard.id } }) } catch (e) { - OC.Notification.showTemporary(t('deck', 'An error occurred')) + OC.Notification.showTemporary(t('deck', `Failed to clone board ${this.board.title}`)) console.error(e) } } diff --git a/src/components/navigation/BoardCloneModal.vue b/src/components/navigation/BoardCloneModal.vue index 084498fe2..28ae2ca0e 100644 --- a/src/components/navigation/BoardCloneModal.vue +++ b/src/components/navigation/BoardCloneModal.vue @@ -1,24 +1,7 @@ + - SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + - SPDX-License-Identifier: AGPL-3.0-or-later +-->