filter:<template>.build changes
-
Related issue https://github.com/NodeBB/NodeBB/issues/4587
As discussed in the issue, we had a bunch of hooks to modify a page on some routes like
filter:recent.build
. These were added as required but most pages didn't have a hook so if you needed one you would have to ask us to add it and wait for the next release. With the above change every route has a hook. The hook name is derived from the template name passed to theres.render(template, data);
method. For example if your template is namedmyAwesomePage
, you render it withres.render('myAwesomePage', data);
and the hook that will be fired isfilter:myAwesomePage.build
Every hook gets 3 parameters
{req: req, res: res, templateData: data}
, data is the parameter you pass into theres.render
method.We had a few inconsistencies in the parameters passed to the hook and the hook name below are the changes that needs to be fixed if you have a plugin that is listening to these hooks.
filter:groups.build
is now calledfilter:group/details.build
as that is the correct name for that template.filter:popular.build
used to pass in a extraterm
parameter, this moved into the templateData parameter.filter:header.build
this is removed it was deprecated a while ago. Usefilter:navigation.available
instead.filter:search.build
parameters changed, data is no longer passed in use req.query and req.params instead. results is now the templateData parameter.
Feel free to ask any questions if anything isn't clear.