Skip to content

Node.js based forum software built for the modern web

fix: bookmark in topic data is nullable now

Julian Lam970a5a6e5f7f
diff --git a/src/topics/index.js b/src/topics/index.js
index d5e997d4c0..3d313d08e6 100644
--- a/src/topics/index.js
+++ b/src/topics/index.js
@@ -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 = [];