mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-03 21:31:10 +02:00
fix: reset user bookmark when topic is marked unread
This commit is contained in:
@@ -28,6 +28,10 @@ module.exports = function (Topics) {
|
||||
await db.sortedSetAdd(`tid:${tid}:bookmarks`, index, uid);
|
||||
};
|
||||
|
||||
Topics.removeUserBookmark = async (tid, uid) => {
|
||||
await db.sortedSetRemove(`tid:${tid}:bookmarks`, uid);
|
||||
};
|
||||
|
||||
Topics.getTopicBookmarks = async function (tid) {
|
||||
return await db.getSortedSetRangeWithScores(`tid:${tid}:bookmarks`, 0, -1);
|
||||
};
|
||||
|
||||
@@ -378,6 +378,7 @@ module.exports = function (Topics) {
|
||||
[`tid:${tid}:bookmarks`, uid],
|
||||
]),
|
||||
db.sortedSetAdd(`uid:${uid}:tids_unread`, Date.now(), tid),
|
||||
Topics.removeUserBookmark(tid, uid),
|
||||
]);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user