Skip to content

Node.js based forum software built for the modern web

closes #5857

Baris Usakli51facb3cb01f
diff --git a/package.json b/package.json
index 09b8d4dfe3..a069249e79 100644
--- a/package.json
+++ b/package.json
@@ -65,9 +65,9 @@
"nodebb-plugin-spam-be-gone": "0.5.0",
"nodebb-rewards-essentials": "0.0.9",
"nodebb-theme-lavender": "4.0.5",
- "nodebb-theme-persona": "5.0.20",
+ "nodebb-theme-persona": "5.0.21",
"nodebb-theme-slick": "1.1.0",
- "nodebb-theme-vanilla": "6.0.15",
+ "nodebb-theme-vanilla": "6.0.16",
"nodebb-widget-essentials": "3.0.1",
"nodemailer": "2.6.4",
"nodemailer-sendmail-transport": "1.0.0",
diff --git a/public/src/client/footer.js b/public/src/client/footer.js
index 8f8e72ba1d..72d689c13a 100644
--- a/public/src/client/footer.js
+++ b/public/src/client/footer.js
@@ -10,7 +10,7 @@ define('forum/footer', ['notifications', 'chat', 'components', 'translator'], fu
if (!utils.isNumber(count)) {
return;
}
- $('a[href="' + config.relative_path + url + '"] i')
+ $('a[href="' + config.relative_path + url + '"].navigation-link i')
.toggleClass('unread-count', count > 0)
.attr('data-content', count > 99 ? '99+' : count);
}
@@ -29,17 +29,33 @@ define('forum/footer', ['notifications', 'chat', 'components', 'translator'], fu
var post = data.posts[0];
if (parseInt(post.uid, 10) !== parseInt(app.user.uid, 10) && !unreadTopics[post.topic.tid]) {
- increaseUnreadCount();
+ increaseUnreadCount(data);
markTopicsUnread(post.topic.tid);
unreadTopics[post.topic.tid] = true;
}
}
}
- function increaseUnreadCount() {
- var count = parseInt($('#unread-count i').attr('data-content'), 10) + 1;
+ function increaseUnreadCount(data) {
+ var post = data.posts[0];
- updateUnreadTopicCount('/unread', count);
+ var unreadTopicCount = parseInt($('a[href="' + config.relative_path + '/unread"].navigation-link i').attr('data-content'), 10) + 1;
+ updateUnreadTopicCount('/unread', unreadTopicCount);
+
+ var isNewTopic = post.isMain && parseInt(post.uid, 10) !== parseInt(app.user.uid);
+ if (isNewTopic) {
+ var unreadNewTopicCount = parseInt($('a[href="' + config.relative_path + '/unread/new"].navigation-link i').attr('data-content'), 10) + 1;
+ updateUnreadTopicCount('/unread/new', unreadNewTopicCount);
+ }
+ socket.emit('topics.isFollowed', post.topic.tid, function (err, isFollowed) {
+ if (err) {
+ return app.alertError(err.message);
+ }
+ if (isFollowed) {
+ var unreadWatchedTopicCount = parseInt($('a[href="' + config.relative_path + '/unread/watched"].navigation-link i').attr('data-content'), 10) + 1;
+ updateUnreadTopicCount('/unread/watched', unreadWatchedTopicCount);
+ }
+ });
}
function markTopicsUnread(tid) {