Skip to content

Commit bdee2be

Browse files
committed
deleted circles shares
Signed-off-by: Maxence Lange <maxence@artificial-owl.com> fix psalm Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent d7bd763 commit bdee2be

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

apps/files_sharing/lib/Controller/DeletedShareAPIController.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ private function formatShare(IShare $share): array {
159159
$result = array_merge($result, $this->getDeckShareHelper()->formatShare($share));
160160
} catch (QueryException $e) {
161161
}
162+
} elseif ($share->getShareType() === IShare::TYPE_CIRCLE) {
163+
try {
164+
$result = array_merge($result, $this->getCirclesShareHelper()->formatShare($share));
165+
} catch (QueryException $e) {
166+
}
162167
}
163168

164169
return $result;
@@ -171,8 +176,9 @@ public function index(): DataResponse {
171176
$groupShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_GROUP, null, -1, 0);
172177
$roomShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_ROOM, null, -1, 0);
173178
$deckShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_DECK, null, -1, 0);
179+
$circlesShares = $this->shareManager->getDeletedSharedWith($this->userId, IShare::TYPE_CIRCLE, null, -1, 0);
174180

175-
$shares = array_merge($groupShares, $roomShares, $deckShares);
181+
$shares = array_merge($groupShares, $roomShares, $deckShares, $circlesShares);
176182

177183
$shares = array_map(function (IShare $share) {
178184
return $this->formatShare($share);
@@ -239,4 +245,21 @@ private function getDeckShareHelper() {
239245

240246
return $this->serverContainer->get('\OCA\Deck\Sharing\ShareAPIHelper');
241247
}
248+
249+
/**
250+
* Returns the helper of ShareAPIHelper for circles shares.
251+
*
252+
* If the Circles application is not enabled or the helper is not available
253+
* a QueryException is thrown instead.
254+
*
255+
* @return \OCA\Circles\ShareAPIHelper
256+
* @throws QueryException
257+
*/
258+
private function getCirclesShareHelper() {
259+
if (!$this->appManager->isEnabledForUser('circles')) {
260+
throw new QueryException();
261+
}
262+
263+
return $this->serverContainer->get('\OCA\Circles\ShareByCircleProvider');
264+
}
242265
}

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
<UndefinedDocblockClass>
125125
<errorLevel type="suppress">
126126
<!-- Helper classes for sharing API integration from other apps -->
127+
<referencedClass name="OCA\Circles\ShareAPIHelper" />
127128
<referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" />
128129
<referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" />
129130
</errorLevel>

0 commit comments

Comments
 (0)