From 5d668112135cd68ff2b50366f630cb1729015153 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sat, 24 Sep 2016 14:53:09 -0500 Subject: [PATCH] Include reply count with posts in topics --- src/topics/posts.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/topics/posts.js b/src/topics/posts.js index 6e15c62b7c..159030b56e 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -65,6 +65,9 @@ module.exports = function (Topics) { voteData: function (next) { posts.getVoteStatusByPostIDs(pids, uid, next); }, + replies: function (next) { + posts.countReplies(pids, next); + }, userData: function (next) { var uids = []; @@ -123,6 +126,7 @@ module.exports = function (Topics) { postObj.upvoted = results.voteData.upvotes[i]; postObj.downvoted = results.voteData.downvotes[i]; postObj.votes = postObj.votes || 0; + postObj.replies = results.replies[i] || 0; postObj.selfPost = !!parseInt(uid, 10) && parseInt(uid, 10) === parseInt(postObj.uid, 10); // Username override for guests, if enabled