From 939e6235476920bf6940c6e6b5435b1948419eea Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 29 Jan 2015 19:49:32 -0500 Subject: [PATCH] collapsing a bunch of whitespace using async.apply, and also fixed #2672 as well --- src/groups.js | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) 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,