Node.js based forum software built for the modern web
fix: remove caller from payload after hooks is done
Barış Soner Uşaklı15f9aaa6ee3a
diff --git a/src/plugins/hooks.js b/src/plugins/hooks.jsindex 24875ca986..1f4866f1df 100644--- a/src/plugins/hooks.js+++ b/src/plugins/hooks.js@@ -96,9 +96,11 @@ Hooks.fire = async function (hook, params) {winston.warn(`[plugins] Unknown hookType: ${hookType}, hook : ${hook}`);return;}+ let deleteCaller = false;if (params && typeof params === 'object' && !params.hasOwnProperty('caller')) {const als = require('../als');params.caller = als.getStore();+ deleteCaller = true;}const result = await hookTypeToMethod[hookType](hook, hookList, params);@@ -107,6 +109,9 @@ Hooks.fire = async function (hook, params) {Hooks.fire('action:plugins.firehook', payload);}if (result !== undefined) {+ if (deleteCaller) {+ delete result.caller;+ }return result;}};