Skip to content

Commit

Permalink
avoid 'No users in here' in user list when there actually are users
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
Julien Veyssier committed Jul 27, 2021
1 parent 702bced commit 14f2863
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
9 changes: 7 additions & 2 deletions apps/settings/src/components/UserList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,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
14 changes: 8 additions & 6 deletions apps/settings/src/store/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ 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 usersCount
}
return false
return 0
})
.catch((error) => {
if (!axios.isCancel(error)) {
Expand All @@ -241,11 +242,12 @@ 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 usersCount
}
return false
return 0
})
.catch((error) => {
if (!axios.isCancel(error)) {
Expand Down

0 comments on commit 14f2863

Please sign in to comment.