From f983f536c6675a5ee4e359667d9c11a280c2b77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 7 Oct 2019 00:47:14 -0400 Subject: [PATCH] fix: check threshold before setting bookmark --- src/socket.io/topics.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) {