if going to users page wait for updateOnlineUsers to complete
v1.18.x
Barış Soner Uşaklı 10 years ago
parent 7abbbbfccf
commit 641c8991f9

@ -48,14 +48,19 @@ middleware.applyCSRF = csrf();
middleware.ensureLoggedIn = ensureLoggedIn.ensureLoggedIn(nconf.get('relative_path') + '/login');
middleware.pageView = function(req, res, next) {
analytics.pageView(req.ip);
if (req.user) {
user.updateLastOnlineTime(req.user.uid);
user.updateOnlineUsers(req.user.uid);
if (req.path.startsWith('/api/users') || req.path.startsWith('/users')) {
user.updateOnlineUsers(req.user.uid, next);
} else {
user.updateOnlineUsers(req.user.uid);
next();
}
} else {
next();
}
analytics.pageView(req.ip);
next();
};
middleware.redirectToAccountIfLoggedIn = function(req, res, next) {

Loading…
Cancel
Save