From ff83305c6a56821dc76f1ca9220c8142c8b18827 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 14 Sep 2015 15:01:35 -0400 Subject: [PATCH] closes #3593 --- src/messaging.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/messaging.js b/src/messaging.js index ab27543f96..72346d52c8 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -255,20 +255,16 @@ var db = require('./database'), user.getMultipleUserFields(uids, ['uid', 'username', 'picture', 'status'] , next); }, teasers: function(next) { - var teasers = []; - async.each(uids, function(fromuid, next) { + async.map(uids, function(fromuid, next) { Messaging.getMessages({ fromuid: fromuid, touid: uid, isNew: false, count: 1 }, function(err, teaser) { - teasers[uids.indexOf(fromuid)] = teaser[0]; - next(err); + next(err, teaser[0]); }); - }, function(err) { - next(err, teasers); - }); + }, next); } }, function(err, results) { if (err) {