summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-02-24 15:01:39 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-02-24 19:39:55 +0000
commita606888f50ce65bb0e526ff9abd336ab4d5bb057 (patch)
tree4a4d68785b4415a8451c28f092fcf8eaa2aa5b26 /apps
parent8006bb982c6de41e7d81c73d1e23f7d667d186cc (diff)
downloadnextcloud-server-a606888f50ce65bb0e526ff9abd336ab4d5bb057.tar.gz
nextcloud-server-a606888f50ce65bb0e526ff9abd336ab4d5bb057.zip
Make sure that the transfer entry is present in the database
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Controller/TransferOwnershipController.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/apps/files/lib/Controller/TransferOwnershipController.php b/apps/files/lib/Controller/TransferOwnershipController.php
index 824c8c00518..639e73187ca 100644
--- a/apps/files/lib/Controller/TransferOwnershipController.php
+++ b/apps/files/lib/Controller/TransferOwnershipController.php
@@ -27,6 +27,7 @@ declare(strict_types=1);
namespace OCA\Files\Controller;
use OCA\Files\BackgroundJob\TransferOwnership;
+use OCA\Files\Db\TransferOwnership as TransferOwnershipEntity;
use OCA\Files\Db\TransferOwnershipMapper;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
@@ -95,7 +96,7 @@ class TransferOwnershipController extends OCSController {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
- $transferOwnership = new \OCA\Files\Db\TransferOwnership();
+ $transferOwnership = new TransferOwnershipEntity();
$transferOwnership->setSourceUser($this->userId);
$transferOwnership->setTargetUser($recipient);
$transferOwnership->setFileId($node->getId());
@@ -132,15 +133,22 @@ class TransferOwnershipController extends OCSController {
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
- $this->jobList->add(TransferOwnership::class, [
- 'id' => $transferOwnership->getId(),
- ]);
-
$notification = $this->notificationManager->createNotification();
$notification->setApp('files')
->setObject('transfer', (string)$id);
$this->notificationManager->markProcessed($notification);
+ $newTransferOwnership = new TransferOwnershipEntity();
+ $newTransferOwnership->setNodeName($transferOwnership->getNodeName());
+ $newTransferOwnership->setFileId($transferOwnership->getFileId());
+ $newTransferOwnership->setSourceUser($transferOwnership->getSourceUser());
+ $newTransferOwnership->setTargetUser($transferOwnership->getTargetUser());
+ $this->mapper->insert($newTransferOwnership);
+
+ $this->jobList->add(TransferOwnership::class, [
+ 'id' => $newTransferOwnership->getId(),
+ ]);
+
return new DataResponse([], Http::STATUS_OK);
}