@ -130,7 +130,7 @@ SocketTopics.markTopicNotificationsRead = function(socket, tid, 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) {
return callback(err);
}
@ -14,6 +14,8 @@ module.exports = function(Topics) {
var unreadCutoff = 86400000 * 2;
Topics.unreadCutoff = unreadCutoff;
Topics.getTotalUnread = function(uid, callback) {
Topics.getUnreadTids(0, uid, 0, 20, function(err, tids) {
callback(err, tids ? tids.length : 0);