Skip to content

Commit

Permalink
deleted circles shares
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Nov 6, 2023
1 parent 045e152 commit 76db2b0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 24 additions & 1 deletion apps/files_sharing/lib/Controller/DeletedShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = '';
Expand All @@ -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);
Expand Down Expand Up @@ -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();

Check notice

Code scanning / Psalm

DeprecatedClass Note

OCP\AppFramework\QueryException is marked deprecated
}

return $this->serverContainer->get('\OCA\Circles\ShareByCircleProvider');
}

/**
* Returns the helper of DeletedShareAPIHelper for sciencemesh shares.
*
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
<UndefinedDocblockClass>
<errorLevel type="suppress">
<!-- Helper classes for sharing API integration from other apps -->
<referencedClass name="OCA\Circles\ShareAPIHelper" />
<referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" />
<referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" />
<referencedClass name="OCA\GlobalSiteSelector\Service\SlaveService"/>
Expand Down

0 comments on commit 76db2b0

Please sign in to comment.