diff options
Diffstat (limited to 'settings')
-rw-r--r-- | settings/src/components/userList.vue | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue index 48c8b9d7b86..c51dce70e24 100644 --- a/settings/src/components/userList.vue +++ b/settings/src/components/userList.vue @@ -206,7 +206,7 @@ export default { if (disabledUsers.length===0 && this.$refs.infiniteLoading && this.$refs.infiniteLoading.isComplete) { // disabled group is empty, redirection to all users this.$router.push({name: 'users'}); - this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset'); + this.$refs.infiniteLoading.stateChanger.reset() } return disabledUsers; } @@ -253,6 +253,9 @@ export default { usersLimit() { return this.$store.getters.getUsersLimit; }, + usersCount() { + return this.users.length + }, /* LANGUAGES */ languages() { @@ -272,8 +275,22 @@ export default { // watch url change and group select selectedGroup: function (val, old) { this.$store.commit('resetUsers'); - this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset'); + this.$refs.infiniteLoading.stateChanger.reset() this.setNewUserDefaultGroup(val); + }, + + // make sure the infiniteLoading state is changed if we manually + // add/remove data from the store + usersCount: function(val, old) { + // deleting the last user, reset the list + if (val === 0 && old === 1) { + this.$refs.infiniteLoading.stateChanger.reset() + // adding the first user, warn the infiniteLoader that + // the list is not empty anymore (we don't fetch the newly + // added user as we already have all the info we need) + } else if (val === 1 && old === 0) { + this.$refs.infiniteLoading.stateChanger.loaded() + } } }, methods: { @@ -313,7 +330,7 @@ export default { search(query) { this.searchQuery = query; this.$store.commit('resetUsers'); - this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset'); + this.$refs.infiniteLoading.stateChanger.reset() }, resetSearch() { this.search(''); @@ -336,7 +353,9 @@ export default { quota: this.newUser.quota.id, language: this.newUser.language.code, }) - .then(() => this.resetForm()) + .then(() => { + this.resetForm() + }) .catch((error) => { this.loading.all = false; if (error.response && error.response.data && error.response.data.ocs && error.response.data.ocs.meta) { |