mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-22 07:23:01 +01:00
feat: allow middlewares to pass in template values via res.locals
This commit is contained in:
@@ -144,6 +144,7 @@ module.exports = function (middleware) {
|
||||
relative_path,
|
||||
bodyClass: options.bodyClass,
|
||||
widgets: options.widgets,
|
||||
...(res.locals.templateValues || {}),
|
||||
};
|
||||
|
||||
templateValues.configJSON = jsesc(JSON.stringify(res.locals.config), { isScriptContext: true });
|
||||
@@ -276,6 +277,7 @@ module.exports = function (middleware) {
|
||||
latestVersion: results.latestVersion,
|
||||
upgradeAvailable: results.latestVersion && semver.gt(results.latestVersion, version),
|
||||
showManageMenu: results.privileges.superadmin || ['categories', 'privileges', 'users', 'admins-mods', 'groups', 'tags', 'settings'].some(priv => results.privileges[`admin:${priv}`]),
|
||||
...(res.locals.templateValues || {}),
|
||||
};
|
||||
|
||||
templateValues.template = { name: res.locals.template };
|
||||
|
||||
Reference in New Issue
Block a user