diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 3b540a0391..06d0167a53 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -72,9 +72,7 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT $(window).trigger('action:topic.loaded'); - socket.emit('topics.markAsRead', tid); - socket.emit('topics.markTopicNotificationsRead', tid); - socket.emit('topics.increaseViewCount', tid); + socket.emit('topics.enter', tid); }; Topic.toTop = function() { diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js index 8e71b9b98d..97e9b36e30 100644 --- a/src/socket.io/topics.js +++ b/src/socket.io/topics.js @@ -54,6 +54,15 @@ SocketTopics.post = function(socket, data, callback) { }); }; +SocketTopics.enter = function(socket, tid, callback) { + if (!tid || !socket.uid) { + return; + } + SocketTopics.markAsRead(socket, tid); + topics.markTopicNotificationsRead(tid, socket.uid); + topics.increaseViewCount(tid); +}; + SocketTopics.postcount = function(socket, tid, callback) { topics.getTopicField(tid, 'postcount', callback); };