mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 09:17:01 +02:00
update unread count
only for logged in users
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user