From 6e5de39ba05984a2791e01fffdb2a48a8b4924c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 27 Feb 2020 18:56:22 -0500 Subject: [PATCH] fix: also fix updating bookmark if sorting is newest_to_oldest --- public/src/client/topic.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index a26f9f6a95..cc955f5442 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -241,6 +241,9 @@ define('forum/topic', [ function updateUserBookmark(index) { var bookmarkKey = 'topic:' + ajaxify.data.tid + ':bookmark'; var currentBookmark = ajaxify.data.bookmark || storage.getItem(bookmarkKey); + if (config.topicPostSort === 'newest_to_oldest') { + index = Math.max(1, ajaxify.data.postcount - index + 2); + } if (ajaxify.data.postcount > ajaxify.data.bookmarkThreshold && (!currentBookmark || parseInt(index, 10) > parseInt(currentBookmark, 10) || ajaxify.data.postcount < parseInt(currentBookmark, 10))) { if (app.user.uid) {