From 5ff2eccbd202c64da5e3e85528488aa6a7ff287d Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 14 Sep 2015 15:10:25 -0400 Subject: [PATCH] #3593 --- src/messaging.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) 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}); }); });