Node.js based forum software built for the modern web
fixing #1587 properly for profile views
psychobunny0334a487b50c
diff --git a/public/src/forum/account/profile.js b/public/src/forum/account/profile.jsindex 6b6d38ad66..47979dc2c5 100644--- a/public/src/forum/account/profile.js+++ b/public/src/forum/account/profile.js@@ -36,6 +36,11 @@ define(['forum/account/header'], function(header) {socket.on('user.isOnline', handleUserOnline);socket.emit('user.isOnline', theirid, handleUserOnline);++console.log('test', yourid, theirid);+ if (yourid !== theirid) {+ socket.emit('user.increaseViewCount', theirid);+ }};function processPage() {diff --git a/src/controllers/accounts.js b/src/controllers/accounts.jsindex a543797b4a..163e4d41cc 100644--- a/src/controllers/accounts.js+++ b/src/controllers/accounts.js@@ -159,10 +159,6 @@ accountsController.getAccount = function(req, res, next) {userData.profileviews = 1;}- if (callerUID !== parseInt(userData.uid, 10) && callerUID && !req.query.prefetched) {- user.incrementUserFieldBy(userData.uid, 'profileviews', 1);- }-postTools.parse(userData.signature, function (err, signature) {userData.signature = signature;diff --git a/src/socket.io/user.js b/src/socket.io/user.jsindex a0ae6c65f9..f6e88c26e4 100644--- a/src/socket.io/user.js+++ b/src/socket.io/user.js@@ -24,6 +24,14 @@ 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);+ }+ }+};+SocketUser.search = function(socket, username, callback) {user.search(username, callback);};