Merge branch 'develop' into activitypub

This commit is contained in:
Barış Soner Uşaklı
2024-04-25 11:16:42 -04:00
270 changed files with 2429 additions and 1668 deletions

View File

@@ -214,7 +214,7 @@ module.exports = function (middleware) {
templateValues.isAdmin = results.user.isAdmin;
templateValues.isGlobalMod = results.user.isGlobalMod;
templateValues.showModMenu = results.user.isAdmin || results.user.isGlobalMod || results.user.isMod;
templateValues.canChat = results.privileges.chat && meta.config.disableChat !== 1;
templateValues.canChat = (results.privileges.chat || results.privileges['chat:privileged']) && meta.config.disableChat !== 1;
templateValues.user = results.user;
templateValues.userJSON = jsesc(JSON.stringify(results.user), { isScriptContext: true });
templateValues.useCustomCSS = meta.config.useCustomCSS && meta.config.customCSS;

View File

@@ -203,8 +203,12 @@ module.exports = function (middleware) {
if (uid <= 0) {
return next();
}
const userslug = await user.getUserField(uid, 'userslug');
if (!userslug) {
const [canView, userslug] = await Promise.all([
privileges.global.can('view:users', req.uid),
user.getUserField(uid, 'userslug'),
]);
if (!userslug || (!canView && req.uid !== uid)) {
return next();
}
const path = req.url.replace(/^\/api/, '')