Skip to content

Node.js based forum software built for the modern web

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

Julian Lam939e62354769
diff --git a/src/groups.js b/src/groups.js
index cb29a9a2d1..4a7611c531 100644
--- a/src/groups.js
+++ b/src/groups.js
@@ -532,18 +532,10 @@ var async = require('async'),
}
async.series([
- function(next) {
- db.setObjectField('group:' + oldName, 'name', newName, next);
- },
- function(next) {
- 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);
- },
+ async.apply(db.setObjectField, 'group:' + oldName, 'name', newName),
+ async.apply(db.setObjectField, 'group:' + oldName, 'slug', utils.slugify(newName)),
+ async.apply(db.deleteObjectField, 'groupslug:groupname', group.slug),
+ async.apply(db.setObjectField, 'groupslug:groupname', utils.slugify(newName), newName),
function(next) {
db.getSortedSetRange('groups:createtime', 0, -1, function(err, groups) {
if (err) {
@@ -554,24 +546,11 @@ var async = require('async'),
}, next);
});
},
- function(next) {
- db.rename('group:' + oldName, 'group:' + newName, next);
- },
- function(next) {
- db.exists('group:' + oldName + ':members', function(err, exists) {
- 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);
- },
+ async.apply(db.rename, 'group:' + oldName, 'group:' + newName),
+ async.apply(db.rename, 'group:' + oldName + ':members', 'group:' + newName + ':members'),
+ async.apply(db.rename, 'group:' + oldName + ':owners', 'group:' + newName + ':owners'),
+ async.apply(db.rename, 'group:' + oldName + ':pending', 'group:' + newName + ':pending'),
+ async.apply(renameGroupMember, 'groups:createtime', oldName, newName),
function(next) {
plugins.fireHook('action:group.rename', {
old: oldName,