mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-14 19:41:41 +02:00
fix: properly allow values in res.locals.templateValues to be added to the template data
This commit is contained in:
@@ -107,7 +107,7 @@ module.exports = function (middleware) {
|
||||
}
|
||||
|
||||
try {
|
||||
await renderMethod(template, options, fn);
|
||||
await renderMethod(template, { ...res.locals.templateValues, ...options }, fn);
|
||||
} catch (err) {
|
||||
next(err);
|
||||
}
|
||||
@@ -144,7 +144,6 @@ 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 });
|
||||
@@ -277,7 +276,6 @@ 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