summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-10-26 16:23:41 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-10-26 16:23:41 +0200
commit7f58c41015dc152b04569d795389b4b0df8e3672 (patch)
tree31e3583ac776c22ef3b24311cc3c65ebf433b529 /apps/files_sharing/lib
parentaa2fd307752a704033bde229628c73bfa00ad217 (diff)
downloadnextcloud-server-7f58c41015dc152b04569d795389b4b0df8e3672.tar.gz
nextcloud-server-7f58c41015dc152b04569d795389b4b0df8e3672.zip
fix sorting
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php
index 1a722817cbd..5d19ed5d427 100644
--- a/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php
+++ b/apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php
@@ -26,7 +26,9 @@ namespace OCA\Files_Sharing\Collaboration;
use OCP\Collaboration\AutoComplete\ISorter;
use OCP\Files\Folder;
+use OCP\Files\IRootFolder;
use OCP\Files\Node;
+use OCP\IUserSession;
use OCP\Share\IManager;
class ShareRecipientSorter implements ISorter {
@@ -34,11 +36,14 @@ class ShareRecipientSorter implements ISorter {
/** @var IManager */
private $shareManager;
/** @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->userFolder = $userFolder;
+ $this->rootFolder = $rootFolder;
+ $this->userSession = $userSession;
}
public function getId() {
@@ -51,7 +56,12 @@ class ShareRecipientSorter implements ISorter {
return;
}
/** @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) {
return;
}