From e4168f4a87c594803d74d16dd8004411a9e8245e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 17 Mar 2017 13:35:24 -0400 Subject: [PATCH] linting --- src/topics/posts.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/topics/posts.js b/src/topics/posts.js index 1e0fd20f42..34e58c55aa 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -105,7 +105,7 @@ module.exports = function (Topics) { Topics.addParentPosts(postData, next); }, replies: function (next) { - +getPostReplies(pids, uid, next); + getPostReplies(pids, uid, next); }, }, next); }, @@ -393,8 +393,12 @@ module.exports = function (Topics) { function getPostReplies(pids, callerUid, callback) { async.map(pids, function (pid, next) { db.getSortedSetRange('pid:' + pid + ':replies', 0, -1, function (err, replyPids) { - var uids = [], -count = 0; + if (err) { + return next(err); + } + + var uids = []; + var count = 0; async.until(function () { return count === replyPids.length || uids.length === 6; @@ -404,15 +408,19 @@ count = 0; if (uids.indexOf(uid) === -1) { uids.push(uid); } - count++; + count += 1; next(err); }); }, function (err) { + if (err) { + return next(err); + } + async.parallel({ - 'users': function (next) { + users: function (next) { user.getUsersWithFields(uids, ['uid', 'username', 'userslug', 'picture'], callerUid, next); }, - 'timestampISO': function (next) { + timestampISO: function (next) { posts.getPostField(replyPids[0], 'timestamp', function (err, timestamp) { next(err, utils.toISOString(timestamp)); });