0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Replace update user last seen middleware with package version

no issue

Part of the goal to move these middleware packages to remove untested code from the codebase
This commit is contained in:
Sam Lord 2021-11-16 15:58:41 +00:00
parent b684f3636e
commit 07f8c6efbb
4 changed files with 9 additions and 16 deletions

View file

@ -1,7 +1,7 @@
module.exports = {
cors: require('./cors'),
normalizeImage: require('./normalize-image'),
updateUserLastSeen: require('./update-user-last-seen'),
updateUserLastSeen: require('@tryghost/mw-update-user-last-seen'),
upload: require('./upload'),
versionMatch: require('./version-match')
};

View file

@ -1,15 +0,0 @@
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);
};

View file

@ -87,6 +87,7 @@
"@tryghost/metrics": "1.0.0",
"@tryghost/minifier": "0.1.0",
"@tryghost/mw-session-from-token": "0.1.26",
"@tryghost/mw-update-user-last-seen": "0.1.0",
"@tryghost/nodemailer": "0.3.6",
"@tryghost/package-json": "1.0.6",
"@tryghost/promise": "0.1.13",

View file

@ -1691,6 +1691,13 @@
resolved "https://registry.yarnpkg.com/@tryghost/mw-session-from-token/-/mw-session-from-token-0.1.26.tgz#41c6acca153cf43e1b4826c75232c56d51d0f1f0"
integrity sha512-VEcOSKK3FWKXKZVY6kASX+O7Gv3W2dTPskgcbp0BTILhCjg+hTFsYBe23v6ukroaEjJ7WxWVrTZyjkkipiw3QA==
"@tryghost/mw-update-user-last-seen@0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@tryghost/mw-update-user-last-seen/-/mw-update-user-last-seen-0.1.0.tgz#21d3b90ac6d63e0f82a4a2bcb7c3ceec684dbe79"
integrity sha512-oCLHg23634bS9pQaatarHOIZr5rm8/v9RwyIa4J/JU3dNdlaWzhm3l0wz1Lh0HUxiC21Hu7QVLa5FFpfbdTvEg==
dependencies:
"@tryghost/constants" "1.0.0"
"@tryghost/nodemailer@0.3.6":
version "0.3.6"
resolved "https://registry.yarnpkg.com/@tryghost/nodemailer/-/nodemailer-0.3.6.tgz#e882f3a103bb30c0357e79d455bca3a402999bea"