diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-12-03 13:42:40 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-12-05 08:38:33 +0100 |
commit | 9b82225966da581f93e7ce8625291732deccf42e (patch) | |
tree | 192d19952832ef47c818866d064cfd0a78f6466a /apps/files_sharing/src/components/SharingInput.vue | |
parent | 5e14b299bcf534e820278939ab98f7ea63858daf (diff) | |
download | nextcloud-server-9b82225966da581f93e7ce8625291732deccf42e.tar.gz nextcloud-server-9b82225966da581f93e7ce8625291732deccf42e.zip |
Use lookup by default
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/src/components/SharingInput.vue')
-rw-r--r-- | apps/files_sharing/src/components/SharingInput.vue | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/apps/files_sharing/src/components/SharingInput.vue b/apps/files_sharing/src/components/SharingInput.vue index 8b4a115a4ba..80ef2ccb2ad 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) |