From 93d4a7c1f1920d16476e5cf1a38c7d211c39fecf Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 17 Oct 2014 18:51:58 -0400 Subject: [PATCH] fix notifications to actually get recent --- src/user/notifications.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/user/notifications.js b/src/user/notifications.js index 9d1f04b1ba..a1319c7b09 100644 --- a/src/user/notifications.js +++ b/src/user/notifications.js @@ -176,7 +176,7 @@ var async = require('async'), var now = Date.now(), yesterday = now - (1000*60*60*24); // Approximate, can be more or less depending on time changes, makes no difference really. - db.getSortedSetRangeByScore('uid:' + uid + ':notifications:unread', 0, 20, yesterday, now, function(err, nids) { + db.getSortedSetRevRangeByScore('uid:' + uid + ':notifications:unread', 0, 20, now, yesterday, function(err, nids) { if (err) { return callback(err); } @@ -193,13 +193,13 @@ var async = require('async'), if (!parseInt(uid, 10)) { return callback(null, 0); } - db.getSortedSetRange('uid:' + uid + ':notifications:unread', 0, 20, function(err, nids) { + db.getSortedSetRevRange('uid:' + uid + ':notifications:unread', 0, 20, function(err, nids) { callback(err, Array.isArray(nids) ? nids.length : 0); }); }; UserNotifications.getUnreadByField = function(uid, field, value, callback) { - db.getSortedSetRange('uid:' + uid + ':notifications:unread', 0, 99, function(err, nids) { + db.getSortedSetRevRange('uid:' + uid + ':notifications:unread', 0, 99, function(err, nids) { if (err) { return callback(err); }