diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php index a849dc4c9de60..a55cfb6df1df5 100644 --- a/apps/files_sharing/lib/Capabilities.php +++ b/apps/files_sharing/lib/Capabilities.php @@ -98,6 +98,11 @@ public function getCapabilities() { 'expire_date' => ['enabled' => true] ]; + // Sharee searches + $res['sharee'] = [ + 'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false) + ]; + return [ 'files_sharing' => $res, ]; diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php index e1546e115ecb2..e97d80363bfd3 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -206,6 +206,14 @@ public function search(string $search = '', string $itemType = null, int $page = $this->limit = (int) $perPage; $this->offset = $perPage * ($page - 1); + // In global scale mode we always search the loogup server + if ($this->config->getSystemValueBool('gs.enabled', false)) { + $lookup = true; + $this->result['lookupEnabled'] = true; + } else { + $this->result['lookupEnabled'] = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes'; + } + list($result, $hasMoreResults) = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset); // extra treatment for 'exact' subarray, with a single merge expected keys might be lost @@ -213,7 +221,6 @@ public function search(string $search = '', string $itemType = null, int $page = $result['exact'] = array_merge($this->result['exact'], $result['exact']); } $this->result = array_merge($this->result, $result); - $this->result['lookupEnabled'] = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes'; $response = new DataResponse($this->result); if ($hasMoreResults) { diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 17b53ffaa6e4f..9756810d2ac6e 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -145,6 +145,14 @@ var deferred = $.Deferred(); var view = this; + // query lookup GS by default if enabled + var capabilities = OC.getCapabilities() + if (capabilities.files_sharing + && capabilities.files_sharing.sharee + && capabilities.files_sharing.sharee.query_lookup_default) { + this._lookup = true; + } + $.get( OC.linkToOCS('apps/files_sharing/api/v1') + 'sharees', {