update unread count

only for logged in users
v1.18.x
barisusakli 11 years ago
parent 0a936e5dd1
commit ca486a1b07

@ -25,20 +25,11 @@ define('forum/footer', ['notifications', 'chat'], function(Notifications, Chat)
}
function onNewPost(data) {
if (data && data.posts && data.posts.length) {
var post = data.posts[0];
if (parseInt(post.uid, 10) !== parseInt(app.uid, 10)) {
increaseUnreadCount();
}
if (parseInt(app.uid, 10)) {
socket.emit('user.getUnreadCount', updateUnreadTopicCount);
}
}
function increaseUnreadCount() {
var count = parseInt($('#unread-count').attr('data-content'), 10) + 1;
updateUnreadTopicCount(null, count);
}
socket.on('event:new_post', onNewPost);
socket.on('event:unread.updateCount', updateUnreadTopicCount);

Loading…
Cancel
Save