From 1c855ce5025bdddfeb7c080769cd32bc94a8a165 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Fri, 5 Jul 2013 18:19:55 -0400 Subject: [PATCH] async.each for get_userslugs_by_uids --- src/user.js | 17 +++++++++++++++-- src/webserver.js | 12 +++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/user.js b/src/user.js index bdd85914c7..8e2eedd51d 100644 --- a/src/user.js +++ b/src/user.js @@ -531,10 +531,23 @@ var utils = require('./../public/src/utils.js'), return callback([]); } + function iterator(uid, callback) { + + User.getUserField(uid, 'userslug', function(userslug) { + userslugs.push(userslug); + callback(null); + }); + } + + async.each(uids, iterator, function(err) { + + callback(userslugs); + }); + // @todo - rework this logic. it doesn't make much sense when you're going through // each and then placing the check logic into the innermost callback. // this is probably a situation where an async.method is ideal - for(var i=0, ii=uids.length; i