fix: #8155, don't validate name on update if groupName didn't change

v1.18.x
Barış Soner Uşaklı 5 years ago
parent ef964b11a8
commit 03a02e5d1d

@ -128,7 +128,6 @@ module.exports = function (Groups) {
} }
async function checkNameChange(currentName, newName) { async function checkNameChange(currentName, newName) {
Groups.validateGroupName(newName);
if (Groups.isPrivilegeGroup(newName)) { if (Groups.isPrivilegeGroup(newName)) {
throw new Error('[[error:invalid-group-name]]'); throw new Error('[[error:invalid-group-name]]');
} }
@ -137,6 +136,7 @@ module.exports = function (Groups) {
if (currentName === newName || currentSlug === newSlug) { if (currentName === newName || currentSlug === newSlug) {
return; return;
} }
Groups.validateGroupName(newName);
const [group, exists] = await Promise.all([ const [group, exists] = await Promise.all([
Groups.getGroupData(currentName), Groups.getGroupData(currentName),
Groups.existsBySlug(newSlug), Groups.existsBySlug(newSlug),

Loading…
Cancel
Save