Skip to content

Node.js based forum software built for the modern web

fix sort by vote insertion

barisusaklia4533703d483
diff --git a/public/src/client/topic.js b/public/src/client/topic.js
index 6b69944ce5..431b36e2c7 100644
--- a/public/src/client/topic.js
+++ b/public/src/client/topic.js
@@ -292,7 +292,7 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
function findInsertionPoint() {
var firstPostTimestamp = parseInt(data.posts[0].timestamp, 10);
var firstPostVotes = parseInt(data.posts[0].votes, 10);
- var firstPostPid = parseInt(data.posts[0].pid, 10);
+ var firstPostIndex = parseInt(data.posts[0].index, 10);
var firstReply = $('#post-container li.post-row[data-index!="0"]').first();
var lastReply = $('#post-container li.post-row[data-index!="0"]').last();
@@ -315,9 +315,9 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
} else if(firstPostVotes < parseInt(firstReply.attr('data-votes'), 10)) {
after = lastReply;
} else {
- if (firstPostPid <= parseInt(firstReply.attr('data-pid'), 10)) {
+ if (firstPostIndex > parseInt(firstReply.attr('data-index'), 10)) {
before = firstReply;
- } else if(firstPostPid > parseInt(firstReply.attr('data-pid'), 10)) {
+ } else if(firstPostIndex <= parseInt(firstReply.attr('data-index'), 10)) {
after = lastReply;
}
}