From a4533703d4835bebb648a37fbd9eb79234eccb1d Mon Sep 17 00:00:00 2001 From: barisusakli Date: Tue, 28 Oct 2014 00:17:28 -0400 Subject: [PATCH] fix sort by vote insertion --- public/src/client/topic.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } }