mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-31 03:47:32 +02:00
Merge branch 'develop' into activitypub
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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/, '')
|
||||
|
||||
Reference in New Issue
Block a user