collapsing a bunch of whitespace using async.apply, and also fixed #2672 as well

v1.18.x
Julian Lam 10 years ago
parent 39cac43b96
commit 939e623547

@ -532,18 +532,10 @@ var async = require('async'),
} }
async.series([ async.series([
function(next) { async.apply(db.setObjectField, 'group:' + oldName, 'name', newName),
db.setObjectField('group:' + oldName, 'name', newName, next); async.apply(db.setObjectField, 'group:' + oldName, 'slug', utils.slugify(newName)),
}, async.apply(db.deleteObjectField, 'groupslug:groupname', group.slug),
function(next) { async.apply(db.setObjectField, 'groupslug:groupname', utils.slugify(newName), newName),
db.setObjectField('group:' + oldName, 'slug', utils.slugify(newName), next);
},
function(next) {
db.deleteObjectField('groupslug:groupname', group.slug, next);
},
function(next) {
db.setObjectField('groupslug:groupname', utils.slugify(newName), newName, next);
},
function(next) { function(next) {
db.getSortedSetRange('groups:createtime', 0, -1, function(err, groups) { db.getSortedSetRange('groups:createtime', 0, -1, function(err, groups) {
if (err) { if (err) {
@ -554,24 +546,11 @@ var async = require('async'),
}, next); }, next);
}); });
}, },
function(next) { async.apply(db.rename, 'group:' + oldName, 'group:' + newName),
db.rename('group:' + oldName, 'group:' + newName, next); async.apply(db.rename, 'group:' + oldName + ':members', 'group:' + newName + ':members'),
}, async.apply(db.rename, 'group:' + oldName + ':owners', 'group:' + newName + ':owners'),
function(next) { async.apply(db.rename, 'group:' + oldName + ':pending', 'group:' + newName + ':pending'),
db.exists('group:' + oldName + ':members', function(err, exists) { async.apply(renameGroupMember, 'groups:createtime', oldName, newName),
if (err) {
return next(err);
}
if (exists) {
db.rename('group:' + oldName + ':members', 'group:' + newName + ':members', next);
} else {
next();
}
});
},
function(next) {
renameGroupMember('groups:createtime', oldName, newName, next);
},
function(next) { function(next) {
plugins.fireHook('action:group.rename', { plugins.fireHook('action:group.rename', {
old: oldName, old: oldName,

Loading…
Cancel
Save