fix mark all read

This commit is contained in:
barisusakli
2015-07-28 15:03:20 -04:00
parent 05411651b3
commit 47cc1083df
2 changed files with 5 additions and 3 deletions

View File

@@ -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);
} }

View File

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