mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
pushNotifCount method for real-time updating of notification bell + favicon for multiple tabs (closes #219)
This commit is contained in:
@@ -147,11 +147,18 @@ var async = require('async'),
|
||||
Notifications.mark_read = function(nid, uid, callback) {
|
||||
if (parseInt(uid, 10) > 0) {
|
||||
Notifications.get(nid, uid, function(notif_data) {
|
||||
db.sortedSetRemove('uid:' + uid + ':notifications:unread', nid);
|
||||
db.sortedSetAdd('uid:' + uid + ':notifications:read', notif_data.datetime, nid);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
async.parallel([
|
||||
function(next) {
|
||||
db.sortedSetRemove('uid:' + uid + ':notifications:unread', nid, next);
|
||||
},
|
||||
function(next) {
|
||||
db.sortedSetAdd('uid:' + uid + ':notifications:read', notif_data.datetime, nid, next);
|
||||
}
|
||||
], function(err) {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user