mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: scope
This commit is contained in:
@@ -17,10 +17,11 @@ module.exports = function (middleware) {
|
|||||||
middleware.processRender = function processRender(req, res, next) {
|
middleware.processRender = function processRender(req, res, next) {
|
||||||
// res.render post-processing, modified from here: https://gist.github.com/mrlannigan/5051687
|
// res.render post-processing, modified from here: https://gist.github.com/mrlannigan/5051687
|
||||||
const { render } = res;
|
const { render } = res;
|
||||||
async function renderMethod(template, options, fn) {
|
|
||||||
|
res.render = async function renderOverride(template, options, fn) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const { req } = this;
|
const { req } = this;
|
||||||
|
async function renderMethod(template, options, fn) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
if (typeof options === 'function') {
|
if (typeof options === 'function') {
|
||||||
fn = options;
|
fn = options;
|
||||||
@@ -87,7 +88,6 @@ module.exports = function (middleware) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render = async function renderOverride(template, options, fn) {
|
|
||||||
try {
|
try {
|
||||||
await renderMethod(template, options, fn);
|
await renderMethod(template, options, fn);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user