From 76db2b06d0b86a2948e20bed086547a9f36fa3b8 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 6 Nov 2023 16:50:41 -0100 Subject: [PATCH] deleted circles shares Signed-off-by: Maxence Lange --- .../Controller/DeletedShareAPIController.php | 25 ++++++++++++++++++- psalm.xml | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php index aec011aa7ac9e..f3473ea1b50cd 100644 --- a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php +++ b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php @@ -169,6 +169,11 @@ private function formatShare(IShare $share): array { $result = array_merge($result, $this->getDeckShareHelper()->formatShare($share)); } catch (QueryException $e) { } + } elseif ($share->getShareType() === IShare::TYPE_CIRCLE) { + try { + $result = array_merge($result, $this->getCirclesShareHelper()->formatShare($share)); + } catch (QueryException $e) { + } } elseif ($share->getShareType() === IShare::TYPE_SCIENCEMESH) { $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = ''; @@ -195,9 +200,10 @@ public function index(): DataResponse { $groupShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_GROUP, null, -1, 0); $roomShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_ROOM, null, -1, 0); $deckShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_DECK, null, -1, 0); + $circlesShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_CIRCLE, null, -1, 0); $sciencemeshShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_SCIENCEMESH, null, -1, 0); - $shares = array_merge($groupShares, $roomShares, $deckShares, $sciencemeshShares); + $shares = array_merge($groupShares, $roomShares, $deckShares, $circlesShares, $sciencemeshShares); $shares = array_map(function (IShare $share) { return $this->formatShare($share); @@ -272,6 +278,23 @@ private function getDeckShareHelper() { return $this->serverContainer->get('\OCA\Deck\Sharing\ShareAPIHelper'); } + /** + * Returns the helper of ShareAPIHelper for circles shares. + * + * If the Circles application is not enabled or the helper is not available + * a QueryException is thrown instead. + * + * @return \OCA\Circles\ShareAPIHelper + * @throws QueryException + */ + private function getCirclesShareHelper() { + if (!$this->appManager->isEnabledForUser('circles')) { + throw new QueryException(); + } + + return $this->serverContainer->get('\OCA\Circles\ShareByCircleProvider'); + } + /** * Returns the helper of DeletedShareAPIHelper for sciencemesh shares. * diff --git a/psalm.xml b/psalm.xml index 4f7c479a15226..26e64cf271d77 100644 --- a/psalm.xml +++ b/psalm.xml @@ -134,6 +134,7 @@ +