diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-07-04 12:05:30 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-07-04 15:40:51 +0200 |
commit | ba13880147a62baa3b1a7337a73355750dcc19bb (patch) | |
tree | 49fe13922d5a311a59083ee0a649fd4d7bcbe8a3 /settings | |
parent | 42912a0e2500f4ce0ff2f9921539283d4239e8a9 (diff) | |
download | nextcloud-server-ba13880147a62baa3b1a7337a73355750dcc19bb.tar.gz nextcloud-server-ba13880147a62baa3b1a7337a73355750dcc19bb.zip |
Fix invalid limit parameter when fetching groups
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'settings')
-rw-r--r-- | settings/src/components/appDetails.vue | 3 | ||||
-rw-r--r-- | settings/src/components/appManagement.vue | 3 | ||||
-rw-r--r-- | settings/src/store/users.js | 6 | ||||
-rw-r--r-- | settings/src/views/Apps.vue | 2 |
4 files changed, 11 insertions, 3 deletions
diff --git a/settings/src/components/appDetails.vue b/settings/src/components/appDetails.vue index 1346378c898..ba48ea9391d 100644 --- a/settings/src/components/appDetails.vue +++ b/settings/src/components/appDetails.vue @@ -60,7 +60,8 @@ <multiselect v-if="isLimitedToGroups(app)" :options="groups" :value="appGroups" @select="addGroupLimitation" @remove="removeGroupLimitation" :options-limit="5" :placeholder="t('settings', 'Limit app usage to groups')" label="name" track-by="id" class="multiselect-vue" - :multiple="true" :close-on-select="false"> + :multiple="true" :close-on-select="false" + @search-change="asyncFindGroup"> <span slot="noResult">{{t('settings', 'No results')}}</span> </multiselect> </div> diff --git a/settings/src/components/appManagement.vue b/settings/src/components/appManagement.vue index efeb2b444a2..bced657bb9f 100644 --- a/settings/src/components/appManagement.vue +++ b/settings/src/components/appManagement.vue @@ -54,6 +54,9 @@ } }, methods: { + asyncFindGroup(query) { + return this.$store.dispatch('getGroups', {search: query, limit: 5, offset: 0}); + }, isLimitedToGroups(app) { if (this.app.groups.length || this.groupCheckedAppsData) { return true; diff --git a/settings/src/store/users.js b/settings/src/store/users.js index a41f9bfcbb1..156b967029f 100644 --- a/settings/src/store/users.js +++ b/settings/src/store/users.js @@ -74,6 +74,9 @@ const mutations = { }, addGroup(state, {gid, displayName}) { try { + if (typeof state.groups.find((group) => group.id === gid) !== 'undefined') { + return; + } // extend group to default values let group = Object.assign({}, defaults.group, { id: gid, @@ -223,7 +226,8 @@ const actions = { getGroups(context, { offset, limit, search }) { search = typeof search === 'string' ? search : ''; - return api.get(OC.linkToOCS(`cloud/groups?offset=${offset}&limit=${limit}&search=${search}`, 2)) + let limitParam = limit === -1 ? '' : `&limit=${limit}`; + return api.get(OC.linkToOCS(`cloud/groups?offset=${offset}&search=${search}${limitParam}`, 2)) .then((response) => { if (Object.keys(response.data.ocs.data.groups).length > 0) { response.data.ocs.data.groups.forEach(function(group) { diff --git a/settings/src/views/Apps.vue b/settings/src/views/Apps.vue index 0f2983eadd6..00e1d95f27e 100644 --- a/settings/src/views/Apps.vue +++ b/settings/src/views/Apps.vue @@ -73,7 +73,7 @@ export default { beforeMount() { this.$store.dispatch('getCategories'); this.$store.dispatch('getAllApps'); - this.$store.dispatch('getGroups', {offset: 0, limit: -1}); + this.$store.dispatch('getGroups', {offset: 0, limit: 5}); this.$store.commit('setUpdateCount', this.$store.getters.getServerData.updateCount) }, mounted() { |