dont modify session for spiders

v1.18.x
Barış Soner Uşaklı 6 years ago
parent 29b63ae7fb
commit 14c4552304

@ -41,11 +41,13 @@ profileController.get = function (req, res, callback) {
} }
userData = _userData; userData = _userData;
req.session.uids_viewed = req.session.uids_viewed || {}; if (!req.isSpider()) {
req.session.uids_viewed = req.session.uids_viewed || {};
if (req.uid !== userData.uid && (!req.session.uids_viewed[userData.uid] || req.session.uids_viewed[userData.uid] < Date.now() - 3600000)) { if (req.uid !== userData.uid && (!req.session.uids_viewed[userData.uid] || req.session.uids_viewed[userData.uid] < Date.now() - 3600000)) {
user.incrementUserFieldBy(userData.uid, 'profileviews', 1); user.incrementUserFieldBy(userData.uid, 'profileviews', 1);
req.session.uids_viewed[userData.uid] = Date.now(); req.session.uids_viewed[userData.uid] = Date.now();
}
} }
async.parallel({ async.parallel({

@ -161,10 +161,12 @@ topicsController.get = function (req, res, callback) {
res.locals.linkTags.push(rel); res.locals.linkTags.push(rel);
}); });
req.session.tids_viewed = req.session.tids_viewed || {}; if (!req.isSpider()) {
if (!req.session.tids_viewed[tid] || req.session.tids_viewed[tid] < Date.now() - 3600000) { req.session.tids_viewed = req.session.tids_viewed || {};
topics.increaseViewCount(tid); if (!req.session.tids_viewed[tid] || req.session.tids_viewed[tid] < Date.now() - 3600000) {
req.session.tids_viewed[tid] = Date.now(); topics.increaseViewCount(tid);
req.session.tids_viewed[tid] = Date.now();
}
} }
if (req.loggedIn) { if (req.loggedIn) {

Loading…
Cancel
Save