simplified calculatePostIndices

This commit is contained in:
barisusakli
2015-09-15 17:19:03 -04:00
parent 76178e3232
commit 51cdd0800c
2 changed files with 9 additions and 21 deletions

View File

@@ -274,17 +274,13 @@ var async = require('async'),
if (!posts.length) {
return next(null, []);
}
var replies = posts;
if (topic.mainPid) {
posts[0].index = 0;
replies = posts.slice(1);
}
var indices = Topics.calculatePostIndices(start, stop, topic.postcount, reverse);
for (var i=1; i<posts.length; ++i) {
if (posts[i]) {
posts[i].index = indices[i - 1];
}
}
Topics.calculatePostIndices(replies, start, stop, topic.postcount, reverse);
Topics.addPostData(posts, uid, next);
}