fix: check threshold before setting bookmark

This commit is contained in:
Barış Soner Uşaklı
2019-10-07 00:47:14 -04:00
parent 4e28e575cf
commit f983f536c6

View File

@@ -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) {