fix(settings): Fix group creation in new account dialog

Signed-off-by: Christopher Ng <chrng8@gmail.com>
pull/51336/head
Christopher Ng 2025-03-25 14:31:45 +07:00
parent b093eff36c
commit 82f0957563
1 changed files with 6 additions and 3 deletions

@ -71,6 +71,7 @@
:multiple="true"
:taggable="true"
:required="!settings.isAdmin && !settings.isDelegatedAdmin"
:create-option="(value) => ({ name: value })"
@input="handleGroupInput"
@search="searchGroups"
@option:created="createGroup" />
@ -145,6 +146,7 @@ import NcSelect from '@nextcloud/vue/components/NcSelect'
import NcTextField from '@nextcloud/vue/components/NcTextField'
import { searchGroups } from '../../service/groups.ts'
import logger from '../../logger.ts'
export default {
name: 'NewUserDialog',
@ -309,11 +311,12 @@ export default {
this.loading.groups = true
try {
await this.$store.dispatch('addGroup', gid)
this.newUser.groups.push(this.groups.find(group => group.id === gid))
this.loading.groups = false
this.availableGroups.push({ id: gid, name: gid })
this.newUser.groups.push({ id: gid, name: gid })
} catch (error) {
this.loading.groups = false
logger.error(t('settings', 'Failed to create group'), { error })
}
this.loading.groups = false
},
/**