aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>2024-10-30 14:07:43 +0100
committerGitHub <noreply@github.com>2024-10-30 14:07:43 +0100
commit9fde83cbeb3caaffc0a1a40edb4b8b3b6b199522 (patch)
tree4f2c3f0d3fb07fe03b743e276f8a7385382be77d /apps
parent301c42233e986d4cad02b5174eaf1f7b66100418 (diff)
parent5b1cbaf583877a07fc3105c89f69ec64d5d89785 (diff)
downloadnextcloud-server-9fde83cbeb3caaffc0a1a40edb4b8b3b6b199522.tar.gz
nextcloud-server-9fde83cbeb3caaffc0a1a40edb4b8b3b6b199522.zip
Merge pull request #48618 from nextcloud/backport/48597/stable30
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Service/OwnershipTransferService.php2
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php5
-rw-r--r--apps/sharebymail/tests/ShareByMailProviderTest.php2
3 files changed, 8 insertions, 1 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index f324d1e449a..d4bc3033b1b 100644
--- a/apps/files/lib/Service/OwnershipTransferService.php
+++ b/apps/files/lib/Service/OwnershipTransferService.php
@@ -422,6 +422,7 @@ class OwnershipTransferService {
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.
@@ -459,6 +460,7 @@ class OwnershipTransferService {
// Try to get the new ID from the target path and suffix of the share
$node = $this->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 b21f6440c64..fd844128827 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -738,11 +738,14 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider
$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 e03fba72312..ae5d768b624 100644
--- a/apps/sharebymail/tests/ShareByMailProviderTest.php
+++ b/apps/sharebymail/tests/ShareByMailProviderTest.php
@@ -773,6 +773,8 @@ class ShareByMailProviderTest extends TestCase {
$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)