This commit is contained in:
barisusakli
2014-05-12 14:51:39 -04:00
parent 9efc341772
commit c7744d7a64
4 changed files with 49 additions and 18 deletions

View File

@@ -115,17 +115,21 @@ var async = require('async'),
Notifications.get(nid, null, function(notif_data) {
async.each(uids, function(uid, next) {
if (parseInt(uid, 10) > 0) {
checkReplace(notif_data.uniqueId, uid, notif_data, function(err, replace) {
if (replace) {
db.sortedSetAdd('uid:' + uid + ':notifications:unread', notif_data.datetime, nid);
websockets.in('uid_' + uid).emit('event:new_notification', notif_data);
}
if (!parseInt(uid, 10)) {
next();
}
if (callback) {
callback(true);
}
});
checkReplace(notif_data.uniqueId, uid, notif_data, function(err, replace) {
if (replace) {
db.sortedSetAdd('uid:' + uid + ':notifications:unread', notif_data.datetime, nid);
websockets.in('uid_' + uid).emit('event:new_notification', notif_data);
}
next();
});
}, function(err) {
if (callback) {
callback(true);
}
});
});