mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: #9533, allow redirect in build hooks
This commit is contained in:
@@ -34,9 +34,15 @@ module.exports = function (middleware) {
|
||||
options.bodyClass = buildBodyClass(req, res, options);
|
||||
|
||||
const buildResult = await plugins.hooks.fire(`filter:${template}.build`, { req: req, res: res, templateData: options });
|
||||
if (res.headersSent) {
|
||||
return;
|
||||
}
|
||||
const templateToRender = buildResult.templateData.templateToRender || template;
|
||||
|
||||
const renderResult = await plugins.hooks.fire('filter:middleware.render', { req: req, res: res, templateData: buildResult.templateData });
|
||||
if (res.headersSent) {
|
||||
return;
|
||||
}
|
||||
options = renderResult.templateData;
|
||||
options._header = {
|
||||
tags: await meta.tags.parse(req, renderResult, res.locals.metaTags, res.locals.linkTags),
|
||||
|
||||
Reference in New Issue
Block a user