From d8ad4ef6b5fc038e8187dc285925cd1a0d7fb5bf Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Sat, 12 Dec 2020 00:25:10 +0100 Subject: use a consistent default value for sharing.maxAutocompleteResults Signed-off-by: Arthur Schiwon --- apps/dav/lib/Connector/Sabre/Principal.php | 6 +++++- apps/dav/lib/DAV/GroupPrincipalBackend.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'apps/dav') diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 12e1d18faa2..bf03569bd5b 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -39,6 +39,7 @@ use OCA\DAV\CalDAV\Proxy\ProxyMapper; use OCA\DAV\Traits\PrincipalProxyTrait; use OCP\App\IAppManager; use OCP\AppFramework\QueryException; +use OCP\Constants; use OCP\IConfig; use OCP\IGroupManager; use OCP\IUser; @@ -270,7 +271,10 @@ class Principal implements BackendInterface { } } - $searchLimit = $this->config->getSystemValue('sharing.maxAutocompleteResults', null); + $searchLimit = $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT); + if ($searchLimit <= 0) { + $searchLimit = null; + } foreach ($searchProperties as $prop => $value) { switch ($prop) { case '{http://sabredav.org/ns}email-address': diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php index 747976b6ad3..8b9c5aa9488 100644 --- a/apps/dav/lib/DAV/GroupPrincipalBackend.php +++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php @@ -27,6 +27,7 @@ namespace OCA\DAV\DAV; +use OCP\Constants; use OCP\IConfig; use OCP\IGroup; use OCP\IGroupManager; @@ -212,7 +213,10 @@ class GroupPrincipalBackend implements BackendInterface { $restrictGroups = $this->groupManager->getUserGroupIds($user); } - $searchLimit = $this->config->getSystemValue('sharing.maxAutocompleteResults', null); + $searchLimit = $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT); + if ($searchLimit <= 0) { + $searchLimit = null; + } foreach ($searchProperties as $prop => $value) { switch ($prop) { case '{DAV:}displayname': -- cgit v1.2.3