mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-10 19:32:03 +02:00
This commit is contained in:
@@ -24,7 +24,7 @@ define('forum/footer', ['notifications', 'chat'], function(Notifications, Chat)
|
||||
.attr('data-content', count > 20 ? '20+' : count);
|
||||
}
|
||||
|
||||
function prepareUnreadButton() {
|
||||
function initUnreadTopics() {
|
||||
var unreadTopics = {};
|
||||
|
||||
function onNewPost(data) {
|
||||
@@ -33,6 +33,7 @@ define('forum/footer', ['notifications', 'chat'], function(Notifications, Chat)
|
||||
|
||||
if (parseInt(post.uid, 10) !== parseInt(app.uid, 10) && !unreadTopics[post.topic.tid]) {
|
||||
increaseUnreadCount();
|
||||
markTopicsUnread(post.topic.tid);
|
||||
unreadTopics[post.topic.tid] = true;
|
||||
}
|
||||
}
|
||||
@@ -43,6 +44,10 @@ define('forum/footer', ['notifications', 'chat'], function(Notifications, Chat)
|
||||
updateUnreadTopicCount(null, count);
|
||||
}
|
||||
|
||||
function markTopicsUnread(tid) {
|
||||
$('[data-tid="' + tid + '"]').addClass('unread');
|
||||
}
|
||||
|
||||
$(window).on('action:ajaxify.end', function(ev, data) {
|
||||
var tid = data.url.match(/^topic\/(\d+)/);
|
||||
|
||||
@@ -60,5 +65,5 @@ define('forum/footer', ['notifications', 'chat'], function(Notifications, Chat)
|
||||
socket.on('event:unread.updateChatCount', updateUnreadChatCount);
|
||||
socket.emit('user.getUnreadChatCount', updateUnreadChatCount);
|
||||
|
||||
prepareUnreadButton();
|
||||
initUnreadTopics();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user