summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-10-25 17:26:50 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-10-25 17:26:50 +0200
commitfa2f03979b8262dfe65dd8c7ce017e1125f87e33 (patch)
treea73c236eef865080b8d435ad8b61445e8568e504 /core/Controller
parent3628d4d65d67d12afc93d969de61cb06a33179fd (diff)
downloadnextcloud-server-fa2f03979b8262dfe65dd8c7ce017e1125f87e33.tar.gz
nextcloud-server-fa2f03979b8262dfe65dd8c7ce017e1125f87e33.zip
add search parameter to autocomplete controller
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/AutoCompleteController.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php
index 839ed7fe6c9..30b08e42503 100644
--- a/core/Controller/AutoCompleteController.php
+++ b/core/Controller/AutoCompleteController.php
@@ -27,6 +27,7 @@ use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\Collaboration\AutoComplete\IManager;
use OCP\Collaboration\Collaborators\ISearch;
+use OCP\IConfig;
use OCP\IRequest;
use OCP\Share;
@@ -35,27 +36,38 @@ class AutoCompleteController extends Controller {
private $collaboratorSearch;
/** @var IManager */
private $autoCompleteManager;
+ /** @var IConfig */
+ private $config;
- public function __construct($appName, IRequest $request, ISearch $collaboratorSearch, IManager $autoCompleteManager) {
+ public function __construct(
+ $appName,
+ IRequest $request,
+ ISearch $collaboratorSearch,
+ IManager $autoCompleteManager,
+ IConfig $config
+ ) {
parent::__construct($appName, $request);
$this->collaboratorSearch = $collaboratorSearch;
$this->autoCompleteManager = $autoCompleteManager;
+ $this->config = $config;
}
/**
* @NoAdminRequired
*
+ * @param string $search
* @param string $itemType
* @param string $itemId
* @param string|null $sorter can be piped, top prio first, e.g.: "commenters|share-recipients"
* @param array $shareTypes
* @return DataResponse
*/
- public function get($itemType, $itemId, $sorter = null, $shareTypes = [Share::SHARE_TYPE_USER]) {
+ public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [Share::SHARE_TYPE_USER]) {
// if enumeration/user listings are disabled, we'll receive an empty
// result from search() – thus nothing else to do here.
- list($results,) = $this->collaboratorSearch->search('', $shareTypes, false, 20, 0);
+ $limit = $this->config->getSystemValue('collaboration.maxAutocompleteResults', 50);
+ list($results,) = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0);
// there won't be exact matches without a search string
unset($results['exact']);