Ghost/core/server/web/api/middleware/update-user-last-seen.js
Daniel Lockyer 8799feb801 Replaced constants file with @tryghost/constants
- extracted constants file into a new package
- replaced all local requires of the file with new package
2020-08-11 12:51:16 +01:00

16 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);
};