diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-02-24 22:38:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 22:38:55 +0300 |
commit | 8108e6f577d72eb092316bfd22e29ba87af20a20 (patch) | |
tree | c378b4c79625f734897eb47a6ee335b513d62b91 /apps | |
parent | aaf1cb70a25896da3dd7ab1d9d1125f8ca62be66 (diff) | |
parent | 1e8048abee1745bab648dba5bf96f956c718e4e3 (diff) |
Merge pull request #19621 from nextcloud/bugfix/noid/transfer-owner-delete-notification
Make sure that the transfer details are present in the database during the cron run
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/lib/Controller/TransferOwnershipController.php | 18 |
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); } |