Ghost/core/server/web/api/middleware/update-user-last-seen.js
Sam Lord 0692ddf57d Revert "Replace update user last seen middleware with package version"
This reverts commit 07f8c6efbb.

Revert "Remove unused unit test file"

This reverts commit f1798119d3.
2021-11-17 11:00:55 +00: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);
};