diff --git a/src/categories.js b/src/categories.js index b5a0938e5b..c536c50854 100644 --- a/src/categories.js +++ b/src/categories.js @@ -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, []); diff --git a/src/user.js b/src/user.js index 790fdd7c6b..3f5444e58f 100644 --- a/src/user.js +++ b/src/user.js @@ -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 = '' + username + ' 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); }); }); diff --git a/src/websockets.js b/src/websockets.js index 0dbf3e5f32..54f1356a90 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -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)); }); } }