diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 71c3731b66b29..c725bf6a4a6cc 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -420,6 +420,7 @@ private function restoreShares( foreach ($shares as ['share' => $share, 'suffix' => $suffix]) { try { + $output->writeln('Transfering share ' . $share->getId() . ' of type ' . $share->getShareType(), OutputInterface::VERBOSITY_VERBOSE); if ($share->getShareType() === IShare::TYPE_USER && $share->getSharedWith() === $destinationUid) { // Unmount the shares before deleting, so we don't try to get the storage later on. @@ -457,6 +458,7 @@ private function restoreShares( // Try to get the new ID from the target path and suffix of the share $node = $rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix)); $newNodeId = $node->getId(); + $output->writeln('Had to change node id to ' . $newNodeId, OutputInterface::VERBOSITY_VERY_VERBOSE); } $share->setNodeId($newNodeId); diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index b21f6440c648f..fd84412882792 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -738,11 +738,14 @@ public function update(IShare $share, ?string $plainTextPassword = null): IShare $shareAttributes = $this->formatShareAttributes($share->getAttributes()); /* - * We allow updating the permissions and password of mail shares + * We allow updating mail shares */ $qb = $this->dbConnection->getQueryBuilder(); $qb->update('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) + ->set('item_source', $qb->createNamedParameter($share->getNodeId())) + ->set('file_source', $qb->createNamedParameter($share->getNodeId())) + ->set('share_with', $qb->createNamedParameter($share->getSharedWith())) ->set('permissions', $qb->createNamedParameter($share->getPermissions())) ->set('uid_owner', $qb->createNamedParameter($share->getShareOwner())) ->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy())) diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index e03fba723128e..ae5d768b624ea 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -773,6 +773,8 @@ public function testUpdate() { $this->share->expects($this->once())->method('getSharedBy')->willReturn($sharedBy); $this->share->expects($this->any())->method('getNote')->willReturn($note); $this->share->expects($this->atLeastOnce())->method('getId')->willReturn($id); + $this->share->expects($this->atLeastOnce())->method('getNodeId')->willReturn($itemSource); + $this->share->expects($this->once())->method('getSharedWith')->willReturn($shareWith); $this->assertSame($this->share, $instance->update($this->share)