mirror of
https://github.com/nextcloud/contacts.git
synced 2025-07-23 00:49:59 +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>
|
- Christian Kraus <hanzi@hanzi.cc>
|
||||||
- Christoph Wurst <christoph@winzerhof-wurst.at>
|
- Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||||
- Daniel Kesselberg <mail@danielkesselberg.de>
|
- Daniel Kesselberg <mail@danielkesselberg.de>
|
||||||
|
- Dominik Kuzila <kuziladominik@gmail.com>
|
||||||
- Gary Kim <gary@garykim.dev>
|
- Gary Kim <gary@garykim.dev>
|
||||||
- Georg Ehrke <oc.list@georgehrke.com>
|
- Georg Ehrke <oc.list@georgehrke.com>
|
||||||
- Greta Doci <gretadoci@gmail.com>
|
- Greta Doci <gretadoci@gmail.com>
|
||||||
|
@ -393,10 +393,14 @@ export default {
|
|||||||
|
|
||||||
this.createGroupError = null
|
this.createGroupError = null
|
||||||
this.logger.debug('Created new local group', { groupName })
|
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
|
// Ellipsis item toggles
|
||||||
|
@ -184,6 +184,9 @@ const actions = {
|
|||||||
* @param {string} groupName the name of the group
|
* @param {string} groupName the name of the group
|
||||||
*/
|
*/
|
||||||
addGroup(context, groupName) {
|
addGroup(context, groupName) {
|
||||||
|
if (!groupName || groupName.trim() === '') {
|
||||||
|
throw new Error('Group name cannot be empty')
|
||||||
|
}
|
||||||
context.commit('addGroup', groupName)
|
context.commit('addGroup', groupName)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user