Skip to content

Node.js based forum software built for the modern web

closes https://github.com/NodeBB/NodeBB/issues/2104

psychobunny004758f5bdae
diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js
index c5db90936a..775686aaa2 100644
--- a/public/src/forum/footer.js
+++ b/public/src/forum/footer.js
@@ -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();
});