only init unread topics for loggedin users

dont call isFollowed
v1.18.x
Barış Soner Uşaklı 6 years ago
parent f75e2ed1ee
commit f4a00f0b5f

@ -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; var unreadUnrepliedTopicCount = parseInt($('a[href="' + config.relative_path + '/unread?filter=unreplied"].navigation-link i').attr('data-content'), 10) + 1;
updateUnreadTopicCount('/unread?filter=unreplied', unreadUnrepliedTopicCount); updateUnreadTopicCount('/unread?filter=unreplied', unreadUnrepliedTopicCount);
} }
socket.emit('topics.isFollowed', post.topic.tid, function (err, isFollowed) { if ($('a[href="' + config.relative_path + '/unread?filter=watched"].navigation-link i').length) {
if (err) { socket.emit('topics.isFollowed', post.topic.tid, function (err, isFollowed) {
return app.alertError(err.message); 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; if (isFollowed) {
updateUnreadTopicCount('/unread?filter=watched', unreadWatchedTopicCount); 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) { function markTopicsUnread(tid) {
@ -96,5 +98,7 @@ define('forum/footer', [
socket.on('event:unread.updateCount', updateUnreadCounters); socket.on('event:unread.updateCount', updateUnreadCounters);
socket.on('event:unread.updateChatCount', updateUnreadChatCount); socket.on('event:unread.updateChatCount', updateUnreadChatCount);
initUnreadTopics(); if (app.user.uid > 0) {
initUnreadTopics();
}
}); });

Loading…
Cancel
Save