diff --git a/lib/Db/ShareWrapperRequest.php b/lib/Db/ShareWrapperRequest.php index fad80612b..6639b27db 100644 --- a/lib/Db/ShareWrapperRequest.php +++ b/lib/Db/ShareWrapperRequest.php @@ -244,6 +244,15 @@ public function getChild(FederatedUser $federatedUser, int $shareId): ShareWrapp return $this->getItemFromRequest($qb); } + /** + * @return ShareWrapper[] + */ + public function getChildren(int $shareId): array { + $qb = $this->getShareSelectSql(); + $qb->limitToShareParent($shareId); + + return $this->getItemsFromRequest($qb); + } /** * @param int $fileId diff --git a/lib/Service/ShareWrapperService.php b/lib/Service/ShareWrapperService.php index c2031e2b3..01b6581c0 100644 --- a/lib/Service/ShareWrapperService.php +++ b/lib/Service/ShareWrapperService.php @@ -292,6 +292,12 @@ public function getChild(IShare $share, FederatedUser $federatedUser): ShareWrap return $this->createChild($share, $federatedUser); } + /** + * @return ShareWrapper[] + */ + public function getChildren(IShare $parent): array { + return $this->shareWrapperRequest->getChildren((int)$parent->getId()); + } public function clearCache(string $singleId): void { $this->cache->clear($singleId); diff --git a/lib/ShareByCircleProvider.php b/lib/ShareByCircleProvider.php index 5d2826fc1..6c0f3a0f6 100644 --- a/lib/ShareByCircleProvider.php +++ b/lib/ShareByCircleProvider.php @@ -757,20 +757,16 @@ private function updateAccessListTokens(array $list, array $shareTokens): array return $result; } - /** - * We don't return a thing about children. - * The call to this function is deprecated and should be removed in next release of NC. - * Also, we get the children in the delete() method. - * - * @param IShare $parent - * - * @return array - */ public function getChildren(IShare $parent): array { - return []; + return array_filter( + array_map( + function (ShareWrapper $wrapper) { + return $wrapper->getShare($this->rootFolder, $this->userManager, $this->urlGenerator); + }, $this->shareWrapperService->getChildren($parent) + ) + ); } - /** * @return iterable */