mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-24 01:10:31 +01:00
mark read after infinite scroll
dont mark read if already read
This commit is contained in:
@@ -149,7 +149,7 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
|
||||
var postcount = $('.user_postcount_' + data.posts[i].uid);
|
||||
postcount.html(parseInt(postcount.html(), 10) + 1);
|
||||
}
|
||||
socket.emit('topics.markAsRead', [tid]);
|
||||
|
||||
createNewPosts(data);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,6 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function updateTopicTitle() {
|
||||
if($(window).scrollTop() > 50) {
|
||||
$('.header-topic-title').find('span').text(ajaxify.variables.get('topic_name')).show();
|
||||
@@ -442,6 +441,7 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
|
||||
});
|
||||
hidePostToolsForDeletedPosts();
|
||||
} else {
|
||||
socket.emit('topics.markAsRead', [tid]);
|
||||
navigator.update();
|
||||
done();
|
||||
}
|
||||
|
||||
@@ -179,6 +179,26 @@ module.exports = function(Topics) {
|
||||
return now;
|
||||
});
|
||||
|
||||
async.parallel({
|
||||
topicScores: function(next) {
|
||||
db.sortedSetScores('topics:recent', tids, next);
|
||||
},
|
||||
userScores: function(next) {
|
||||
db.sortedSetScores('uid:' + uid + ':tids_read', tids, next);
|
||||
}
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
tids = tids.filter(function(tid, index) {
|
||||
return !results.userScores[index] || results.userScores[index] < results.topicScores[index];
|
||||
});
|
||||
|
||||
if (!tids.length) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
async.parallel({
|
||||
markRead: function(next) {
|
||||
db.sortedSetAdd('uid:' + uid + ':tids_read', scores, tids, next);
|
||||
@@ -199,6 +219,7 @@ module.exports = function(Topics) {
|
||||
|
||||
categories.markAsRead(cids, uid, callback);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Topics.markTopicNotificationsRead = function(tid, uid) {
|
||||
|
||||
Reference in New Issue
Block a user