getMultipleUserFields returns err now

v1.18.x
Baris Usakli 12 years ago
parent 2fc9afa4f4
commit efa8717fc5

@ -57,8 +57,8 @@ var RDB = require('./redis.js'),
}
function getActiveUsers(next) {
user.getMultipleUserFields(active_users, ['username', 'userslug', 'picture'], function(users) {
next(null, users);
user.getMultipleUserFields(active_users, ['username', 'userslug', 'picture'], function(err, users) {
next(err, users);
});
}
@ -112,8 +112,8 @@ var RDB = require('./redis.js'),
RDB.smembers('cid:' + cid + ':moderators', function(err, mods) {
if(!err) {
if(mods && mods.length) {
user.getMultipleUserFields(mods, ['username'], function(moderators) {
callback(null, moderators);
user.getMultipleUserFields(mods, ['username'], function(err, moderators) {
callback(err, moderators);
});
} else {
callback(null, []);

@ -150,8 +150,7 @@ var utils = require('./../public/src/utils.js'),
User.getMultipleUserFields = function(uids, fields, callback) {
if(uids.length === 0) {
callback([]);
return;
return callback(null, []);
}
var returnData = [];
@ -160,22 +159,17 @@ var utils = require('./../public/src/utils.js'),
return self.indexOf(value) === index;
});
function iterator(uid, callback) {
function iterator(uid, next) {
User.getUserFields(uid, fields, function(err, userData) {
if(err)
return callback(err);
return next(err);
returnData.push(userData);
callback(null);
next(null);
});
}
async.eachSeries(uuids, iterator, function(err) {
if(!err) {
callback(returnData);
} else {
console.log(err);
callback(null);
}
callback(err, returnData);
});
}
@ -600,7 +594,7 @@ var utils = require('./../public/src/utils.js'),
topics.getTopicField(tid, 'slug', function(err, slug) {
var message = '<strong>' + username + '</strong> made a new post';
notifications.create(message, 5, nconf.get('url') + 'topic/' + slug + '#' + pid, 'notification_'+ Date.now(), function(nid) {
notifications.create(message, 5, nconf.get('relative_path') + '/topic/' + slug + '#' + pid, 'notification_'+ Date.now(), function(nid) {
notifications.push(nid, followers);
});
});

@ -144,8 +144,9 @@ var SocketIO = require('socket.io').listen(global.server, {
if (uids.length === 0) {
io.sockets.in(roomName).emit('api:get_users_in_room', userList([], anonymousCount, 0));
} else {
user.getMultipleUserFields(uids, ['username', 'userslug'], function(users) {
io.sockets.in(roomName).emit('api:get_users_in_room', userList(users, anonymousCount, users.length));
user.getMultipleUserFields(uids, ['username', 'userslug'], function(err, users) {
if(!err)
io.sockets.in(roomName).emit('api:get_users_in_room', userList(users, anonymousCount, users.length));
});
}
}

Loading…
Cancel
Save