diff options
Diffstat (limited to 'settings/src/components/userList.vue')
-rw-r--r-- | settings/src/components/userList.vue | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue index 18d3609a163..7ef95a314b5 100644 --- a/settings/src/components/userList.vue +++ b/settings/src/components/userList.vue @@ -144,12 +144,19 @@ export default { if (!this.settings.canChangePassword) { OC.Notification.showTemporary(t('settings', 'Password change is disabled because the master key is disabled')); } + /** * Init default language from server data. The use of this.settings - * requires a computed variable,vwhich break the v-model binding of the form, - * this is a much easier solution than getter and setter + * requires a computed variable, which break the v-model binding of the form, + * this is a much easier solution than getter and setter on a computed var */ Vue.set(this.newUser.language, 'code', this.settings.defaultLanguage); + + /** + * In case the user directly loaded the user list within a group + * the watch won't be triggered. We need to initialize it. + */ + this.setNewUserDefaultGroup(this.$route.params.selectedGroup); }, computed: { settings() { @@ -212,6 +219,7 @@ export default { selectedGroup: function (val, old) { this.$store.commit('resetUsers'); this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset'); + this.setNewUserDefaultGroup(val); } }, methods: { @@ -241,8 +249,9 @@ export default { this.$store.dispatch('getUsers', { offset: this.usersOffset, limit: this.usersLimit, - group: this.selectedGroup !== 'disabled' ? this.selectedGroup : ''}) - .then((response) => {response?$state.loaded():$state.complete()}); + group: this.selectedGroup !== 'disabled' ? this.selectedGroup : '' + }) + .then((response) => { response ? $state.loaded() : $state.complete() }); }, resetForm() { @@ -261,6 +270,18 @@ export default { quota: this.newUser.quota.id, language: this.newUser.language.code, }).then(() => this.resetForm()); + }, + setNewUserDefaultGroup(value) { + if (value && value.length > 0) { + // setting new user default group to the current selected one + let currentGroup = this.groups.find(group => group.id === value); + if (currentGroup) { + this.newUser.groups = [currentGroup]; + return; + } + } + // fallback, empty selected group + this.newUser.groups = []; } } } |