only init unread topics for loggedin users

dont call isFollowed
This commit is contained in:
Barış Soner Uşaklı
2018-11-19 15:03:53 -05:00
parent f75e2ed1ee
commit f4a00f0b5f

View File

@@ -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();
}
});