Skip to content

Node.js based forum software built for the modern web

fix: check threshold before setting bookmark

Barış Soner Uşaklıf983f536c667
diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js
index b06d302ab1..6669dc8a89 100644
--- a/src/socket.io/topics.js
+++ b/src/socket.io/topics.js
@@ -53,7 +53,10 @@ SocketTopics.bookmark = async function (socket, data) {
if (!socket.uid || !data) {
throw new Error('[[error:invalid-data]]');
}
- await topics.setUserBookmark(data.tid, socket.uid, data.index);
+ const postcount = await topics.getTopicField(data.tid, 'postcount');
+ if (data.index > meta.config.bookmarkThreshold && postcount > meta.config.bookmarkThreshold) {
+ await topics.setUserBookmark(data.tid, socket.uid, data.index);
+ }
};
SocketTopics.createTopicFromPosts = async function (socket, data) {