fix: bookmark in topic data is nullable now

This prevents the superfluous "/1" being appended to all topics you've never been into.

This looks to be a change in the public API but the documented API lists this property as nullable already, so it looks like this commit is actually *restoring* proper behaviour.
This commit is contained in:
Julian Lam
2024-01-17 23:11:16 -05:00
parent 60bc27ec69
commit 970a5a6e5f

View File

@@ -138,9 +138,9 @@ 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 = sortNewToOld ?
topic.bookmark = bookmarks[i] && (sortNewToOld ?
Math.max(1, topic.postcount + 2 - bookmarks[i]) :
Math.min(topic.postcount, bookmarks[i] + 1);
Math.min(topic.postcount, bookmarks[i] + 1));
topic.unreplied = !topic.teaser;
topic.icons = [];