Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user list infinite loading state in user settings #25879

Merged
merged 2 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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