derpy globals to get notification pushing working for sockets on new notification event

v1.18.x
Julian Lam 12 years ago
parent d0646ba98f
commit 2a829a0618

@ -138,6 +138,10 @@
if (counts.unread > 0) notifIcon.className = 'icon-circle active';
else notifIcon.className = 'icon-circle-blank';
});
socket.on('event:new_notification', function() {
console.log('WOOT');
document.querySelector('.notifications a i').className = 'icon-circle active';
});
socket.emit('api:notifications.counts');
}());
</script>

@ -55,6 +55,7 @@ var config = require('../config.js'),
(function(uid) {
Notifications.remove_by_uniqueId(notif_data.uniqueId, uid, function() {
RDB.zadd('uid:' + uid + ':notifications:unread', notif_data.score, nid);
global.io.sockets.in('uid_' + uid).emit('event:new_notification');
if (callback) callback(true);
});
})(uids[x]);

@ -1,5 +1,5 @@
var SocketIO = require('socket.io').listen(global.server,{log:false}),
var SocketIO = require('socket.io').listen(global.server, { log:false }),
cookie = require('cookie'),
connect = require('connect'),
config = require('../config.js'),
@ -57,6 +57,7 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}),
userSockets[uid].push(socket);
user.go_online(uid);
socket.join('uid_' + uid);
/*process.on('uncaughtException', function(err) {
// handle the error safely

Loading…
Cancel
Save