Skip to content

Commit

Permalink
Merge pull request #25879 from nextcloud/fix/user-list-infinite-loading
Browse files Browse the repository at this point in the history
Fix user list infinite loading state in user settings
  • Loading branch information
szaimen authored Sep 3, 2021
2 parents 6a9afe3 + 073a673 commit 46837e2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
6 changes: 3 additions & 3 deletions apps/settings/js/vue-settings-apps-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-apps-users-management.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions apps/settings/js/vue-settings-users.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/js/vue-settings-users.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions apps/settings/src/components/UserList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,13 @@ export default {
group: this.selectedGroup !== 'disabled' ? this.selectedGroup : '',
search: this.searchQuery,
})
.then((response) => {
response ? $state.loaded() : $state.complete()
.then((usersCount) => {
if (usersCount > 0) {
$state.loaded()
}
if (usersCount < this.usersLimit) {
$state.complete()
}
})
},

Expand Down
12 changes: 6 additions & 6 deletions apps/settings/src/store/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ const actions = {
cancelToken: searchRequestCancelSource.token,
})
.then((response) => {
if (Object.keys(response.data.ocs.data.users).length > 0) {
const usersCount = Object.keys(response.data.ocs.data.users).length
if (usersCount > 0) {
context.commit('appendUsers', response.data.ocs.data.users)
return Object.keys(response.data.ocs.data.users).length >= limit
}
return false
return usersCount
})
.catch((error) => {
if (!axios.isCancel(error)) {
Expand All @@ -241,11 +241,11 @@ const actions = {
cancelToken: searchRequestCancelSource.token,
})
.then((response) => {
if (Object.keys(response.data.ocs.data.users).length > 0) {
const usersCount = Object.keys(response.data.ocs.data.users).length
if (usersCount > 0) {
context.commit('appendUsers', response.data.ocs.data.users)
return Object.keys(response.data.ocs.data.users).length >= limit
}
return false
return usersCount
})
.catch((error) => {
if (!axios.isCancel(error)) {
Expand Down

0 comments on commit 46837e2

Please sign in to comment.