mirror of
https://github.com/nextcloud/contacts.git
synced 2025-07-20 16:54:44 +00:00
fix: validate group name
Signed-off-by: Dominik Kuzila <kuziladominik@gmail.com>
This commit is contained in:

committed by
Dominik Kuzila

parent
f493e3662f
commit
eb4ea50c8d
@ -9,6 +9,7 @@
|
||||
- Christian Kraus <hanzi@hanzi.cc>
|
||||
- Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
- Daniel Kesselberg <mail@danielkesselberg.de>
|
||||
- Dominik Kuzila <kuziladominik@gmail.com>
|
||||
- Gary Kim <gary@garykim.dev>
|
||||
- Georg Ehrke <oc.list@georgehrke.com>
|
||||
- Greta Doci <gretadoci@gmail.com>
|
||||
|
@ -393,10 +393,14 @@ export default {
|
||||
|
||||
this.createGroupError = null
|
||||
this.logger.debug('Created new local group', { groupName })
|
||||
this.$store.dispatch('addGroup', groupName)
|
||||
this.isNewGroupMenuOpen = false
|
||||
|
||||
emit('contacts:group:append', groupName)
|
||||
try {
|
||||
this.$store.dispatch('addGroup', groupName)
|
||||
this.isNewGroupMenuOpen = false
|
||||
emit('contacts:group:append', groupName)
|
||||
} catch (error) {
|
||||
showError(t('contacts', 'An error occurred while creating the group'))
|
||||
}
|
||||
},
|
||||
|
||||
// Ellipsis item toggles
|
||||
|
@ -184,6 +184,9 @@ const actions = {
|
||||
* @param {string} groupName the name of the group
|
||||
*/
|
||||
addGroup(context, groupName) {
|
||||
if (!groupName || groupName.trim() === '') {
|
||||
throw new Error('Group name cannot be empty')
|
||||
}
|
||||
context.commit('addGroup', groupName)
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user