mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
simplified calculatePostIndices
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user