diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-02-21 12:02:18 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-02-21 12:02:18 +0100 |
commit | 6be9fdaa48fe4406049b4b713fba2997e48540be (patch) | |
tree | 66612eef73862c94f9b87fd283d191372b7de501 /settings | |
parent | 10388eab342a46e034eb6bfb89fbfd232d8ec2a5 (diff) | |
download | nextcloud-server-6be9fdaa48fe4406049b4b713fba2997e48540be.tar.gz nextcloud-server-6be9fdaa48fe4406049b4b713fba2997e48540be.zip |
Fix infiniteLoading state after user add/remove
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
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) { |