Skip to content

Node.js based forum software built for the modern web

feat: add response:helpers.notAllowed

Barış Soner Uşaklıe8058ca35c67
diff --git a/src/controllers/helpers.js b/src/controllers/helpers.js
index c5f62658b0..d893463352 100644
--- a/src/controllers/helpers.js
+++ b/src/controllers/helpers.js
@@ -123,6 +123,11 @@ helpers.buildTerms = function (url, term, query) {
helpers.notAllowed = async function (req, res, error) {
({ error } = await plugins.hooks.fire('filter:helpers.notAllowed', { req, res, error }));
+ await plugins.hooks.fire('response:helpers.notAllowed', { req, res, error });
+ if (res.headersSent) {
+ return;
+ }
+
if (req.loggedIn || req.uid === -1) {
if (res.locals.isAPI) {
if (req.originalUrl.startsWith(`${relative_path}/api/v3`)) {