mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
closes #3881
This commit is contained in:
@@ -32,6 +32,7 @@ module.exports = function(middleware) {
|
||||
options.bodyClass = buildBodyClass(req);
|
||||
|
||||
res.locals.template = template;
|
||||
options._locals = undefined;
|
||||
|
||||
if (res.locals.isAPI) {
|
||||
if (req.route && req.route.path === '/api/') {
|
||||
@@ -46,12 +47,14 @@ module.exports = function(middleware) {
|
||||
}
|
||||
|
||||
var ajaxifyData = JSON.stringify(options);
|
||||
|
||||
|
||||
render.call(self, template, options, function(err, str) {
|
||||
if (err) {
|
||||
return fn(err);
|
||||
}
|
||||
|
||||
|
||||
ajaxifyData = ajaxifyData.replace(/<\//g, '<\\/');
|
||||
|
||||
str = str + '<script id="ajaxify-data" type="application/json">' + ajaxifyData + '</script>';
|
||||
|
||||
str = (res.locals.postHeader ? res.locals.postHeader : '') + str + (res.locals.preFooter ? res.locals.preFooter : '');
|
||||
|
||||
Reference in New Issue
Block a user