From 1982edfde3f40cc85608804f3b0161bd38d2a6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 11 Mar 2021 18:47:50 -0500 Subject: [PATCH] refactor: fix variable name --- src/topics/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/topics/index.js b/src/topics/index.js index f687c68cba..bce9bc2fa9 100644 --- a/src/topics/index.js +++ b/src/topics/index.js @@ -111,7 +111,7 @@ Topics.getTopicsByTids = async function (tids, options) { user.getSettings(uid), ]); - const sortOldToNew = callerSettings.topicPostSort === 'newest_to_oldest'; + const sortNewToOld = callerSettings.topicPostSort === 'newest_to_oldest'; result.topics.forEach((topic, i) => { if (topic) { topic.thumbs = result.thumbs[i]; @@ -127,7 +127,7 @@ Topics.getTopicsByTids = async function (tids, options) { topic.isOwner = topic.uid === parseInt(uid, 10); topic.ignored = isIgnored[i]; topic.unread = parseInt(uid, 10) > 0 && !hasRead[i] && !isIgnored[i]; - topic.bookmark = sortOldToNew ? + topic.bookmark = sortNewToOld ? Math.max(1, topic.postcount + 2 - bookmarks[i]) : Math.min(topic.postcount, bookmarks[i] + 1); topic.unreplied = !topic.teaser;