Node.js based forum software built for the modern web
async.each for get_userslugs_by_uids
Baris Soner Usakli1c855ce5025b
diff --git a/src/user.js b/src/user.jsindex 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<ii; ++i) {+ /*for(var i=0, ii=uids.length; i<ii; ++i) {User.getUserField(uids[i],'userslug', function(userslug) {userslugs.push(userslug);@@ -542,7 +555,7 @@ var utils = require('./../public/src/utils.js'),callback(userslugs);}});- }+ }*/}User.get_uid_by_email = function(email, callback) {diff --git a/src/webserver.js b/src/webserver.jsindex 9814c1c103..bc41745f0a 100644--- a/src/webserver.js+++ b/src/webserver.js@@ -320,11 +320,17 @@ var express = require('express'),});});- app.all('/test', function(req, res) {++ app.get('/test', function(req, res) {++ console.log('derp');+ user.get_userslugs_by_uids([1,2], function(data) {+ res.send(data);+ });- categories.getCategoryById(1,1, function(data) {+/* categories.getCategoryById(1,1, function(data) {res.send(data);- },1);+ },1);*/});