fix notifications to actually get recent

v1.18.x
barisusakli 10 years ago
parent 6cb5f9c098
commit 93d4a7c1f1

@ -176,7 +176,7 @@ var async = require('async'),
var now = Date.now(), var now = Date.now(),
yesterday = now - (1000*60*60*24); // Approximate, can be more or less depending on time changes, makes no difference really. 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) { if (err) {
return callback(err); return callback(err);
} }
@ -193,13 +193,13 @@ var async = require('async'),
if (!parseInt(uid, 10)) { if (!parseInt(uid, 10)) {
return callback(null, 0); 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); callback(err, Array.isArray(nids) ? nids.length : 0);
}); });
}; };
UserNotifications.getUnreadByField = function(uid, field, value, callback) { 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) { if (err) {
return callback(err); return callback(err);
} }

Loading…
Cancel
Save