Skip to content

Commit

Permalink
Merge pull request #40718 from nextcloud/backport/40428/stable27
Browse files Browse the repository at this point in the history
[stable27] Multiple bug fix in users list
  • Loading branch information
blizzz authored Oct 9, 2023
2 parents 35d7351 + 617f5ae commit a762275
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
12 changes: 11 additions & 1 deletion apps/settings/src/components/UserList/UserRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@
:user-select="true"
:options="possibleManagers"
:placeholder="t('settings', 'Select manager')"
:loading="loadingPossibleManagers || loading.manager"
class="multiselect-vue"
label="displayname"
track-by="id"
@open="searchInitialUserManager"
@search-change="searchUserManager"
@remove="updateUserManager"
@select="updateUserManager">
Expand Down Expand Up @@ -336,6 +338,7 @@ export default {
rand: parseInt(Math.random() * 1000),
openedMenu: false,
feedbackMessage: '',
loadingPossibleManagers: false,
possibleManagers: [],
currentManager: '',
editing: false,
Expand Down Expand Up @@ -387,7 +390,6 @@ export default {
},
},
async beforeMount() {
await this.searchUserManager()
if (this.user.manager) {
await this.initManager(this.user.manager)
}
Expand Down Expand Up @@ -431,11 +433,19 @@ export default {
filterManagers(managers) {
return managers.filter((manager) => manager.id !== this.user.id)
},
async initManager(userId) {
await this.$store.dispatch('getUser', userId).then(response => {
this.currentManager = response?.data.ocs.data
})
},
async searchInitialUserManager() {
this.loadingPossibleManagers = true
await this.searchUserManager()
this.loadingPossibleManagers = false
},
async searchUserManager(query) {
await this.$store.dispatch('searchUsers', { offset: 0, limit: 10, search: query }).then(response => {
const users = response?.data ? this.filterManagers(Object.values(response?.data.ocs.data.users)) : []
Expand Down
5 changes: 5 additions & 0 deletions apps/settings/src/store/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ const mutations = {
},
// update active/disabled counts, groups counts
updateUserCounts(state, { user, actionType }) {
// 0 is a special value
if (state.userCount === 0) {
return
}

const disabledGroup = state.groups.find(group => group.id === 'disabled')
switch (actionType) {
case 'enable':
Expand Down
4 changes: 2 additions & 2 deletions dist/settings-users-8351.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-users-8351.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-apps-users-management.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

0 comments on commit a762275

Please sign in to comment.