removed unused .getAll method, and sorting notifications client-side so that unread notifs don't all appear at the top, #2772

v1.18.x
Julian Lam 10 years ago
parent ade12116a1
commit 29873f1c5c

@ -22,7 +22,9 @@ define('notifications', ['sounds'], function(sound) {
return app.alertError(err.message);
}
var notifs = data.unread.concat(data.read);
var notifs = data.unread.concat(data.read).sort(function(a, b) {
return parseInt(a.datetime, 10) > parseInt(b.datetime, 10) ? -1 : 1;
});
translator.toggleTimeagoShorthand();
for(var i=0; i<notifs.length; ++i) {

@ -89,20 +89,6 @@ var async = require('async'),
});
}
UserNotifications.getAll = function(uid, count, callback) {
getNotifications(uid, count, function(err, notifs) {
if (err) {
return callback(err);
}
notifs = notifs.unread.concat(notifs.read);
notifs = notifs.filter(Boolean).sort(function(a, b) {
return b.datetime - a.datetime;
});
callback(null, notifs);
});
};
UserNotifications.getNotifications = function(nids, uid, callback) {
notifications.getMultiple(nids, function(err, notifications) {
if (err) {

Loading…
Cancel
Save