diff --git a/src/messaging.js b/src/messaging.js index 72346d52c8..81a0a5fe4c 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -274,6 +274,9 @@ var db = require('./database'), results.users.forEach(function(user, index) { if (user && !parseInt(user.uid, 10)) { Messaging.markRead(uid, uids[index]); + user.unread = results.unread[index]; + user.status = sockets.isUserOnline(user.uid) ? user.status : 'offline'; + user.teaser = results.teasers[index]; } }); @@ -281,18 +284,6 @@ var db = require('./database'), return user && parseInt(user.uid, 10); }); - if (!results.users.length) { - return callback(null, {users: [], nextStart: stop + 1}); - } - - results.users.forEach(function(user, index) { - if (user) { - user.unread = results.unread[index]; - user.status = sockets.isUserOnline(user.uid) ? user.status : 'offline'; - user.teaser = results.teasers[index]; - } - }); - callback(null, {users: results.users, nextStart: stop + 1}); }); });