diff --git a/apps/files_sharing/js/dist/files_sharing_tab.js b/apps/files_sharing/js/dist/files_sharing_tab.js index 8d15366c22f51f79cc0b88034c3d813a9c980736..a9af7be5167c9970ccf2e9da483e2d34fbf38f91 100644 Binary files a/apps/files_sharing/js/dist/files_sharing_tab.js and b/apps/files_sharing/js/dist/files_sharing_tab.js differ diff --git a/apps/files_sharing/js/dist/files_sharing_tab.js.map b/apps/files_sharing/js/dist/files_sharing_tab.js.map index e7edd67837ba1588cda12948cb23c280a270e010..df52dda1b3ec639d881824cbc0c902a3256f067f 100644 Binary files a/apps/files_sharing/js/dist/files_sharing_tab.js.map and b/apps/files_sharing/js/dist/files_sharing_tab.js.map differ diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php index 26062ef51bcafca7145d0592cfdc5827877f6b6a..ec475f61e9101b970e77ade98da1b3018dad00ad 100644 --- a/apps/files_sharing/lib/Capabilities.php +++ b/apps/files_sharing/lib/Capabilities.php @@ -112,6 +112,11 @@ class Capabilities implements ICapability { '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 e750235470d400c67e95638c020bb2565e0001f4..7bc772f3bf59c3ca08f516e24f47d8fd3371c0f5 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -207,6 +207,14 @@ class ShareesAPIController extends OCSController { $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 @@ -214,7 +222,6 @@ class ShareesAPIController extends OCSController { $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/apps/files_sharing/src/components/SharingInput.vue b/apps/files_sharing/src/components/SharingInput.vue index 8b4a115a4bafd383251ca144190ce1bd5c610afe..80ef2ccb2add6d3dcba792c0baae40af609dd4ba 100644 --- a/apps/files_sharing/src/components/SharingInput.vue +++ b/apps/files_sharing/src/components/SharingInput.vue @@ -23,6 +23,7 @@ <template> <Multiselect ref="multiselect" class="sharing-input" + :clear-on-select="false" :disabled="!canReshare" :hide-selected="true" :internal-search="false" @@ -176,10 +177,12 @@ export default { * @param {string} search the search query * @param {boolean} [lookup=false] search on lookup server */ - async getSuggestions(search, lookup) { + async getSuggestions(search, lookup = false) { this.loading = true - lookup = lookup || false - console.info(search, lookup) + + if (OC.getCapabilities().files_sharing.sharee.query_lookup_default === true) { + lookup = true + } const request = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', { params: { @@ -215,8 +218,9 @@ export default { .sort((a, b) => a.shareType - b.shareType) // lookup clickable entry + // show if enabled and not already requested const lookupEntry = [] - if (data.lookupEnabled) { + if (data.lookupEnabled && !lookup) { lookupEntry.push({ isNoUser: true, displayName: t('files_sharing', 'Search globally'), @@ -388,9 +392,18 @@ export default { */ async addShare(value) { if (value.lookup) { - return this.getSuggestions(this.query, true) + await this.getSuggestions(this.query, true) + + // focus the input again + this.$nextTick(() => { + this.$refs.multiselect.$el.querySelector('.multiselect__input').focus() + }) + return true } + // TODO: reset the search string when done + // https://github.com/shentao/vue-multiselect/issues/633 + // handle externalResults from OCA.Sharing.ShareSearch if (value.handler) { const share = await value.handler(this)