fix: #8188, fix bookmark if sorting is newest_to_oldest

This commit is contained in:
Barış Soner Uşaklı
2020-02-27 17:21:36 -05:00
parent ac241fb830
commit 32ada7c4e7
2 changed files with 16 additions and 2 deletions

View File

@@ -28,6 +28,8 @@ define('forum/topic/posts', [
updatePostCounts(data.posts);
updatePostIndices(data.posts);
ajaxify.data.postcount += 1;
postTools.updatePostCount(ajaxify.data.postcount);
@@ -61,6 +63,16 @@ define('forum/topic/posts', [
}
}
function updatePostIndices(posts) {
if (config.topicPostSort === 'newest_to_oldest') {
posts[0].index = 1;
components.get('post').not('[data-index=0]').each(function () {
var newIndex = parseInt($(this).attr('data-index'), 10) + 1;
$(this).attr('data-index', newIndex);
});
}
}
function onNewPostPagination(data) {
function scrollToPost() {
scrollToPostIfSelf(data.posts[0]);