fixing #1587 properly for unread count

v1.18.x
psychobunny 11 years ago
parent 08bbf7fdd8
commit 791fde7904

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

Loading…
Cancel
Save