mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
fixing #1587 properly for unread count
This commit is contained in:
@@ -73,6 +73,9 @@ define(['forum/pagination', 'forum/infinitescroll', 'forum/topic/threadTools', '
|
||||
$(window).on('scroll', updateTopicTitle);
|
||||
|
||||
$(window).trigger('action:topic.loaded');
|
||||
|
||||
socket.emit('topics.markAsRead', {tid: tid, uid: app.uid});
|
||||
socket.emit('topics.increaseViewCount', tid);
|
||||
};
|
||||
|
||||
function showBottomPostBar() {
|
||||
|
||||
@@ -162,18 +162,6 @@ topicsController.get = function(req, res, next) {
|
||||
topic_url += '?' + queryString;
|
||||
}
|
||||
|
||||
|
||||
if (!req.query.prefetched) {
|
||||
topics.increaseViewCount(tid);
|
||||
|
||||
if (uid) {
|
||||
topics.markAsRead(tid, uid, function(err) {
|
||||
topics.pushUnreadCount(uid);
|
||||
topics.markTopicNotificationsRead(tid, uid);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Paginator for noscript
|
||||
data.pages = [];
|
||||
for(var x=1; x<=data.pageCount; x++) {
|
||||
|
||||
@@ -57,6 +57,10 @@ SocketTopics.postcount = function(socket, tid, callback) {
|
||||
topics.getTopicField(tid, 'postcount', callback);
|
||||
};
|
||||
|
||||
SocketTopics.increaseViewCount = function(socket, tid) {
|
||||
topics.increaseViewCount(tid);
|
||||
}
|
||||
|
||||
SocketTopics.markAsRead = function(socket, data) {
|
||||
if(!data || !data.tid || !data.uid) {
|
||||
return;
|
||||
|
||||
@@ -27,7 +27,7 @@ SocketUser.emailExists = function(socket, data, callback) {
|
||||
SocketUser.increaseViewCount = function(socket, uid, callback) {
|
||||
if (uid) {
|
||||
if (socket.uid !== parseInt(uid, 10)) {
|
||||
user.incrementUserFieldBy(uid, 'profileviews', 1);
|
||||
user.incrementUserFieldBy(uid, 'profileviews', 1, callback);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user