fix: dont lower bookmark

also ignore guests/spiders
This commit is contained in:
Barış Soner Uşaklı
2022-12-12 12:17:14 -05:00
parent 43561734cc
commit 574dd8eecb

View File

@@ -22,7 +22,13 @@ module.exports = function (Topics) {
};
Topics.setUserBookmark = async function (tid, uid, index) {
await db.sortedSetAdd(`tid:${tid}:bookmarks`, index, uid);
if (parseInt(uid, 10) <= 0) {
return;
}
const currentIndex = await db.sortedSetScore(`tid:${tid}:bookmarks`, uid);
if (!currentIndex || index > currentIndex) {
await db.sortedSetAdd(`tid:${tid}:bookmarks`, index, uid);
}
};
Topics.getTopicBookmarks = async function (tid) {