diff --git a/public/src/modules/notifications.js b/public/src/modules/notifications.js index 86723dc3e5..533199c31c 100644 --- a/public/src/modules/notifications.js +++ b/public/src/modules/notifications.js @@ -102,9 +102,11 @@ define('notifications', ['sounds', 'translator', 'components'], function(sound, ajaxify.refresh(); } - if (!unreadNotifs[notifData.nid]) { - incrementNotifCount(1); + socket.emit('notifications.getCount', function(err, count) { + Notifications.updateNotifCount(count); + }); + if (!unreadNotifs[notifData.nid]) { sound.play('notification'); unreadNotifs[notifData.nid] = true; } diff --git a/src/socket.io/helpers.js b/src/socket.io/helpers.js index dfcecf7f5c..9efeb4c5d9 100644 --- a/src/socket.io/helpers.js +++ b/src/socket.io/helpers.js @@ -167,6 +167,12 @@ SocketHelpers.sendNotificationToTopicOwner = function(tid, fromuid, command, not SocketHelpers.rescindUpvoteNotification = function(pid, fromuid) { var nid = 'upvote:post:' + pid + ':uid:' + fromuid; notifications.rescind(nid); + + posts.getPostField(pid, 'uid', function(err, uid) { + user.notifications.getUnreadCount(uid, function(err, count) { + websockets.in('uid_' + uid).emit('event:notifications.updateCount', count); + }); + }); }; SocketHelpers.emitToTopicAndCategory = function(event, data) {