mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
fix mark all read
This commit is contained in:
@@ -130,7 +130,7 @@ SocketTopics.markTopicNotificationsRead = function(socket, tid, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SocketTopics.markAllRead = function(socket, data, callback) {
|
SocketTopics.markAllRead = function(socket, data, callback) {
|
||||||
topics.getLatestTidsFromSet('topics:recent', 0, -1, 'day', function(err, tids) {
|
db.getSortedSetRevRangeByScore('topics:recent', 0, -1, '+inf', Date.now() - topics.unreadCutoff, function(err, tids) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ module.exports = function(Topics) {
|
|||||||
|
|
||||||
var unreadCutoff = 86400000 * 2;
|
var unreadCutoff = 86400000 * 2;
|
||||||
|
|
||||||
|
Topics.unreadCutoff = unreadCutoff;
|
||||||
|
|
||||||
Topics.getTotalUnread = function(uid, callback) {
|
Topics.getTotalUnread = function(uid, callback) {
|
||||||
Topics.getUnreadTids(0, uid, 0, 20, function(err, tids) {
|
Topics.getUnreadTids(0, uid, 0, 20, function(err, tids) {
|
||||||
callback(err, tids ? tids.length : 0);
|
callback(err, tids ? tids.length : 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user