diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-12-16 10:47:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-16 10:47:32 +0100 |
commit | 1d4c8961ef1f65840f732297869996434a50f6d6 (patch) | |
tree | b45891eac66bf33568f6ef6de6cf638b1eb2b7be /lib | |
parent | 7a774930388d3214be810c0f40e7d58f4109b455 (diff) | |
parent | abad2efb449c5cbb29b5eb6a6e2227f0ef0074fc (diff) | |
download | nextcloud-server-1d4c8961ef1f65840f732297869996434a50f6d6.tar.gz nextcloud-server-1d4c8961ef1f65840f732297869996434a50f6d6.zip |
Merge pull request #24659 from nextcloud/enh/noid/dav-honour-sharing.maxAutocompleteResults
dav principal search to honour sharing.maxAutocompleteResults setting
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Contacts/ContactsMenu/Manager.php | 3 | ||||
-rw-r--r-- | lib/private/Template/JSConfigHelper.php | 5 | ||||
-rw-r--r-- | lib/public/Constants.php | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/Contacts/ContactsMenu/Manager.php b/lib/private/Contacts/ContactsMenu/Manager.php index 8f772b8e027..d08db5775e5 100644 --- a/lib/private/Contacts/ContactsMenu/Manager.php +++ b/lib/private/Contacts/ContactsMenu/Manager.php @@ -27,6 +27,7 @@ namespace OC\Contacts\ContactsMenu; use OCP\App\IAppManager; +use OCP\Constants; use OCP\Contacts\ContactsMenu\IEntry; use OCP\IConfig; use OCP\IUser; @@ -63,7 +64,7 @@ class Manager { * @return array */ public function getEntries(IUser $user, $filter) { - $maxAutocompleteResults = $this->config->getSystemValueInt('sharing.maxAutocompleteResults', 25); + $maxAutocompleteResults = max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT)); $minSearchStringLength = $this->config->getSystemValueInt('sharing.minSearchStringLength', 0); $topEntries = []; if (strlen($filter) >= $minSearchStringLength) { diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index ebe799bf4f8..83c8d7c0e42 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -33,6 +33,7 @@ namespace OC\Template; use bantu\IniGetWrapper\IniGetWrapper; use OC\CapabilitiesManager; use OCP\App\IAppManager; +use OCP\Constants; use OCP\Defaults; use OCP\IConfig; use OCP\IGroupManager; @@ -189,8 +190,8 @@ class JSConfigHelper { 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value 'lost_password_link' => $this->config->getSystemValue('lost_password_link', null), 'modRewriteWorking' => $this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true', - 'sharing.maxAutocompleteResults' => (int)$this->config->getSystemValue('sharing.maxAutocompleteResults', 0), - 'sharing.minSearchStringLength' => (int)$this->config->getSystemValue('sharing.minSearchStringLength', 0), + 'sharing.maxAutocompleteResults' => max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT)), + 'sharing.minSearchStringLength' => $this->config->getSystemValueInt('sharing.minSearchStringLength', 0), 'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX, ]; diff --git a/lib/public/Constants.php b/lib/public/Constants.php index 2653031a430..64872821582 100644 --- a/lib/public/Constants.php +++ b/lib/public/Constants.php @@ -52,4 +52,10 @@ class Constants { * longer support windows as server platform. */ public const FILENAME_INVALID_CHARS = "\\/"; + + /** + * @since 21.0.0 – default value for autocomplete/search results limit, + * cf. sharing.maxAutocompleteResults in config.sample.php. + */ + public const SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT = 25; } |