Fix merging backend results
* Merge share types correctly * Filter share types * Order share types Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
ce7eb02685
commit
fc4d0a86ef
|
@ -148,9 +148,12 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
|
|||
$values = array_map(function (\OCP\Files\Node $node) use ($shares) {
|
||||
/** @var IShare[] $shares */
|
||||
$shares = (isset($shares[$node->getId()])) ? $shares[$node->getId()] : [];
|
||||
return array_map(function(IShare $share) {
|
||||
$types = array_map(function(IShare $share) {
|
||||
return $share->getShareType();
|
||||
}, $shares);
|
||||
$types = array_unique($types);
|
||||
sort($types);
|
||||
return $types;
|
||||
}, $children);
|
||||
|
||||
$keys = array_map(function (\OCP\Files\Node $node) {
|
||||
|
|
|
@ -574,7 +574,7 @@ class FederatedShareProvider implements IShareProvider {
|
|||
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
||||
))
|
||||
->andWhere(
|
||||
$qb->expr()->eq('shareType', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_REMOTE))
|
||||
$qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_REMOTE))
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -466,7 +466,8 @@ class DefaultShareProvider implements IShareProvider {
|
|||
|
||||
$qb->andWhere($qb->expr()->orX(
|
||||
$qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_USER)),
|
||||
$qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP))
|
||||
$qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)),
|
||||
$qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_LINK))
|
||||
));
|
||||
|
||||
/**
|
||||
|
|
|
@ -887,7 +887,15 @@ class Manager implements IManager {
|
|||
$providers = $this->factory->getAllProviders();
|
||||
|
||||
return array_reduce($providers, function($shares, IShareProvider $provider) use ($userId, $node, $reshares) {
|
||||
return $shares + $provider->getSharesInFolder($userId, $node, $reshares);
|
||||
$newShares = $provider->getSharesInFolder($userId, $node, $reshares);
|
||||
foreach ($newShares as $fid => $data) {
|
||||
if (!isset($shares[$fid])) {
|
||||
$shares[$fid] = [];
|
||||
}
|
||||
|
||||
$shares[$fid] = array_merge($shares[$fid], $data);
|
||||
}
|
||||
return $shares;
|
||||
}, []);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue