Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/Db/ShareWrapperRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/Service/ShareWrapperService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 7 additions & 11 deletions lib/ShareByCircleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Loading