|
|
@ -45,6 +45,7 @@ module.exports = function(Groups) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async.series([
|
|
|
|
async.series([
|
|
|
|
|
|
|
|
async.apply(checkNameChange, groupName, values.name),
|
|
|
|
async.apply(updatePrivacy, groupName, values.private),
|
|
|
|
async.apply(updatePrivacy, groupName, values.private),
|
|
|
|
function(next) {
|
|
|
|
function(next) {
|
|
|
|
if (values.hasOwnProperty('hidden')) {
|
|
|
|
if (values.hasOwnProperty('hidden')) {
|
|
|
@ -217,6 +218,23 @@ module.exports = function(Groups) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function checkNameChange(oldName, newName, callback) {
|
|
|
|
|
|
|
|
if (oldName === newName) {
|
|
|
|
|
|
|
|
return callback();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var oldSlug = utils.slugify(oldName);
|
|
|
|
|
|
|
|
var newSlug = utils.slugify(newName);
|
|
|
|
|
|
|
|
if (oldSlug === newSlug) {
|
|
|
|
|
|
|
|
return callback();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Groups.existsBySlug(newSlug, function(err, exists) {
|
|
|
|
|
|
|
|
if (err || exists) {
|
|
|
|
|
|
|
|
return callback(err || new Error('[[error:group-already-exists]]'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
callback();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function renameGroup(oldName, newName, callback) {
|
|
|
|
function renameGroup(oldName, newName, callback) {
|
|
|
|
if (oldName === newName || !newName || newName.length === 0) {
|
|
|
|
if (oldName === newName || !newName || newName.length === 0) {
|
|
|
|
return callback();
|
|
|
|
return callback();
|
|
|
|