Merge branch 'master' into develop

This commit is contained in:
Barış Soner Uşaklı
2024-06-11 18:28:21 -04:00
2 changed files with 7 additions and 1 deletions

View File

@@ -14,8 +14,11 @@ followController.getFollowers = async function (req, res, next) {
await getFollow('account/followers', 'followers', req, res, next); await getFollow('account/followers', 'followers', req, res, next);
}; };
async function getFollow(tpl, name, req, res) { async function getFollow(tpl, name, req, res, next) {
const { userData: payload } = res.locals; const { userData: payload } = res.locals;
if (!payload) {
return next();
}
const { const {
username, userslug, followerCount, followingCount, username, userslug, followerCount, followingCount,
} = payload; } = payload;

View File

@@ -260,6 +260,9 @@ module.exports = function (middleware) {
} }
res.locals.userData = await accountHelpers.getUserDataByUserSlug(req.params.userslug, req.uid, req.query); res.locals.userData = await accountHelpers.getUserDataByUserSlug(req.params.userslug, req.uid, req.query);
if (!res.locals.userData) {
return next('route');
}
next(); next();
}; };