fix sorting
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
aa2fd30775
commit
7f58c41015
|
@ -19,6 +19,7 @@ return array(
|
||||||
'OCA\\Files_Sharing\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
|
'OCA\\Files_Sharing\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
|
||||||
'OCA\\Files_Sharing\\Cache' => $baseDir . '/../lib/Cache.php',
|
'OCA\\Files_Sharing\\Cache' => $baseDir . '/../lib/Cache.php',
|
||||||
'OCA\\Files_Sharing\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
|
'OCA\\Files_Sharing\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
|
||||||
|
'OCA\\Files_Sharing\\Collaboration\\ShareRecipientSorter' => $baseDir . '/../lib/Collaboration/ShareRecipientSorter.php',
|
||||||
'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => $baseDir . '/../lib/Command/CleanupRemoteStorages.php',
|
'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => $baseDir . '/../lib/Command/CleanupRemoteStorages.php',
|
||||||
'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => $baseDir . '/../lib/Controller/ExternalSharesController.php',
|
'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => $baseDir . '/../lib/Controller/ExternalSharesController.php',
|
||||||
'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => $baseDir . '/../lib/Controller/PublicPreviewController.php',
|
'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => $baseDir . '/../lib/Controller/PublicPreviewController.php',
|
||||||
|
|
|
@ -34,6 +34,7 @@ class ComposerStaticInitf32f03f7cd82bff20d6a51be16689441
|
||||||
'OCA\\Files_Sharing\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
|
'OCA\\Files_Sharing\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
|
||||||
'OCA\\Files_Sharing\\Cache' => __DIR__ . '/..' . '/../lib/Cache.php',
|
'OCA\\Files_Sharing\\Cache' => __DIR__ . '/..' . '/../lib/Cache.php',
|
||||||
'OCA\\Files_Sharing\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
|
'OCA\\Files_Sharing\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
|
||||||
|
'OCA\\Files_Sharing\\Collaboration\\ShareRecipientSorter' => __DIR__ . '/..' . '/../lib/Collaboration/ShareRecipientSorter.php',
|
||||||
'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => __DIR__ . '/..' . '/../lib/Command/CleanupRemoteStorages.php',
|
'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => __DIR__ . '/..' . '/../lib/Command/CleanupRemoteStorages.php',
|
||||||
'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => __DIR__ . '/..' . '/../lib/Controller/ExternalSharesController.php',
|
'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => __DIR__ . '/..' . '/../lib/Controller/ExternalSharesController.php',
|
||||||
'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => __DIR__ . '/..' . '/../lib/Controller/PublicPreviewController.php',
|
'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => __DIR__ . '/..' . '/../lib/Controller/PublicPreviewController.php',
|
||||||
|
|
|
@ -26,7 +26,9 @@ namespace OCA\Files_Sharing\Collaboration;
|
||||||
|
|
||||||
use OCP\Collaboration\AutoComplete\ISorter;
|
use OCP\Collaboration\AutoComplete\ISorter;
|
||||||
use OCP\Files\Folder;
|
use OCP\Files\Folder;
|
||||||
|
use OCP\Files\IRootFolder;
|
||||||
use OCP\Files\Node;
|
use OCP\Files\Node;
|
||||||
|
use OCP\IUserSession;
|
||||||
use OCP\Share\IManager;
|
use OCP\Share\IManager;
|
||||||
|
|
||||||
class ShareRecipientSorter implements ISorter {
|
class ShareRecipientSorter implements ISorter {
|
||||||
|
@ -34,11 +36,14 @@ class ShareRecipientSorter implements ISorter {
|
||||||
/** @var IManager */
|
/** @var IManager */
|
||||||
private $shareManager;
|
private $shareManager;
|
||||||
/** @var Folder */
|
/** @var Folder */
|
||||||
private $userFolder;
|
private $rootFolder;
|
||||||
|
/** @var IUserSession */
|
||||||
|
private $userSession;
|
||||||
|
|
||||||
public function __construct(IManager $shareManager, Folder $userFolder) {
|
public function __construct(IManager $shareManager, IRootFolder $rootFolder, IUserSession $userSession) {
|
||||||
$this->shareManager = $shareManager;
|
$this->shareManager = $shareManager;
|
||||||
$this->userFolder = $userFolder;
|
$this->rootFolder = $rootFolder;
|
||||||
|
$this->userSession = $userSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId() {
|
public function getId() {
|
||||||
|
@ -51,7 +56,12 @@ class ShareRecipientSorter implements ISorter {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/** @var Node[] $nodes */
|
/** @var Node[] $nodes */
|
||||||
$nodes = $this->userFolder->getById((int)$context['itemId']);
|
$user = $this->userSession->getUser();
|
||||||
|
if($user === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
|
||||||
|
$nodes = $userFolder->getById((int)$context['itemId']);
|
||||||
if(count($nodes) === 0) {
|
if(count($nodes) === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Manager implements IManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerSorter($className) {
|
public function registerSorter($className) {
|
||||||
$sorters[] = $className;
|
$this->sorters[] = $className;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSorters() {
|
protected function getSorters() {
|
||||||
|
|
Loading…
Reference in New Issue