From fee591e55166d5cf503c58e45397d3a25cae39a7 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 28 May 2014 17:43:03 -0400 Subject: [PATCH] fixes #1587 --- public/src/ajaxify.js | 3 +++ src/controllers/topics.js | 16 +++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index d42a225a5a..36dcb16489 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -292,6 +292,9 @@ var ajaxify = ajaxify || {}; if (this.host === window.location.host) { // Internal link var url = this.href.replace(rootUrl + '/', ''); + url = url + (url.match(/\?/) ? '&' : '?') + 'prefetched=true'; + console.log(url); + ajaxify.loadData(url, function(err, data) { ajaxify.preloader = { url: url, diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 1ddae407ae..fadfc47fba 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -163,15 +163,17 @@ topicsController.get = function(req, res, next) { } - if (uid) { - topics.markAsRead(tid, uid, function(err) { - topics.pushUnreadCount(uid); - topics.markTopicNotificationsRead(tid, uid); - }); + if (!req.query.prefetched) { + topics.increaseViewCount(tid); + + if (uid) { + topics.markAsRead(tid, uid, function(err) { + topics.pushUnreadCount(uid); + topics.markTopicNotificationsRead(tid, uid); + }); + } } - topics.increaseViewCount(tid); - // Paginator for noscript data.pages = []; for(var x=1; x<=data.pageCount; x++) {