Skip to content

Node.js based forum software built for the modern web

only init unread topics for loggedin users

Barış Soner Uşaklıf4a00f0b5fa8
diff --git a/public/src/client/footer.js b/public/src/client/footer.js
index ebf023cb57..73c6a775f2 100644
--- a/public/src/client/footer.js
+++ b/public/src/client/footer.js
@@ -58,15 +58,17 @@ define('forum/footer', [
var unreadUnrepliedTopicCount = parseInt($('a[href="' + config.relative_path + '/unread?filter=unreplied"].navigation-link i').attr('data-content'), 10) + 1;
updateUnreadTopicCount('/unread?filter=unreplied', unreadUnrepliedTopicCount);
}
- 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?filter=watched"].navigation-link i').attr('data-content'), 10) + 1;
- updateUnreadTopicCount('/unread?filter=watched', unreadWatchedTopicCount);
- }
- });
+ if ($('a[href="' + config.relative_path + '/unread?filter=watched"].navigation-link i').length) {
+ 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?filter=watched"].navigation-link i').attr('data-content'), 10) + 1;
+ updateUnreadTopicCount('/unread?filter=watched', unreadWatchedTopicCount);
+ }
+ });
+ }
}
function markTopicsUnread(tid) {
@@ -96,5 +98,7 @@ define('forum/footer', [
socket.on('event:unread.updateCount', updateUnreadCounters);
socket.on('event:unread.updateChatCount', updateUnreadChatCount);
- initUnreadTopics();
+ if (app.user.uid > 0) {
+ initUnreadTopics();
+ }
});