mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 21:03:29 +03:00
a92c61ab49
no issue
15 lines
355 B
JavaScript
15 lines
355 B
JavaScript
const constants = require('@tryghost/constants');
|
|
|
|
module.exports = function updateUserLastSeenMiddleware(req, _res, next) {
|
|
if (!req.user) {
|
|
return next();
|
|
}
|
|
|
|
if (Date.now() - req.user.get('last_seen') < constants.ONE_HOUR_MS) {
|
|
return next();
|
|
}
|
|
|
|
req.user.updateLastSeen().then(() => {
|
|
next();
|
|
}, next);
|
|
}; |