mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
add client-side unread count support for the "new" filter
This commit is contained in:
@@ -13,6 +13,12 @@ define('forum/footer', ['notifications', 'chat', 'components', 'translator'], fu
|
|||||||
.attr('data-content', count > 99 ? '99+' : count);
|
.attr('data-content', count > 99 ? '99+' : count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateUnreadNewTopicCount(count) {
|
||||||
|
$('#unread-new-count i')
|
||||||
|
.toggleClass('unread-count', count > 0)
|
||||||
|
.attr('data-content', count > 99 ? '99+' : count);
|
||||||
|
}
|
||||||
|
|
||||||
function updateUnreadChatCount(count) {
|
function updateUnreadChatCount(count) {
|
||||||
components.get('chat/icon')
|
components.get('chat/icon')
|
||||||
.toggleClass('unread-count', count > 0)
|
.toggleClass('unread-count', count > 0)
|
||||||
@@ -61,6 +67,7 @@ define('forum/footer', ['notifications', 'chat', 'components', 'translator'], fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateUnreadTopicCount(data.unreadTopicCount);
|
updateUnreadTopicCount(data.unreadTopicCount);
|
||||||
|
updateUnreadNewTopicCount(data.unreadNewTopicCount);
|
||||||
updateUnreadChatCount(data.unreadChatCount);
|
updateUnreadChatCount(data.unreadChatCount);
|
||||||
Notifications.updateNotifCount(data.unreadNotificationCount);
|
Notifications.updateNotifCount(data.unreadNotificationCount);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ SocketUser.getUnreadCounts = function(socket, data, callback) {
|
|||||||
}
|
}
|
||||||
async.parallel({
|
async.parallel({
|
||||||
unreadTopicCount: async.apply(topics.getTotalUnread, socket.uid),
|
unreadTopicCount: async.apply(topics.getTotalUnread, socket.uid),
|
||||||
|
unreadNewTopicCount: async.apply(topics.getTotalUnread, socket.uid, 'new'),
|
||||||
unreadChatCount: async.apply(messaging.getUnreadCount, socket.uid),
|
unreadChatCount: async.apply(messaging.getUnreadCount, socket.uid),
|
||||||
unreadNotificationCount: async.apply(user.notifications.getUnreadCount, socket.uid)
|
unreadNotificationCount: async.apply(user.notifications.getUnreadCount, socket.uid)
|
||||||
}, callback);
|
}, callback);
|
||||||
|
|||||||
Reference in New Issue
Block a user