Skip to content

Node.js based forum software built for the modern web

#5223

barisusaklidcb67737821e
diff --git a/src/topics.js b/src/topics.js
index 71e103d0aa..900a46d604 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -234,10 +234,13 @@ var social = require('./social');
function getMainPostAndReplies(topic, set, uid, start, stop, reverse, callback) {
async.waterfall([
function (next) {
- if (start > 0 && stop > 0) {
- start--;
+ if (stop > 0) {
stop--;
+ if (start > 0) {
+ start --;
+ }
}
+
posts.getPidsFromSet(set, start, stop, reverse, next);
},
function (pids, next) {
@@ -247,7 +250,6 @@ var social = require('./social');
if (topic.mainPid && start === 0) {
pids.unshift(topic.mainPid);
- pids.pop();
}
posts.getPostsByPids(pids, uid, next);
},