mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 09:36:16 +01:00
Revert "feat: add _hooks metadata object to all hooks that have object-type params"
This reverts commit 46899ccadb.
This commit is contained in:
@@ -96,17 +96,6 @@ Hooks.fire = async function (hook, params) {
|
|||||||
winston.warn(`[plugins] Unknown hookType: ${hookType}, hook : ${hook}`);
|
winston.warn(`[plugins] Unknown hookType: ${hookType}, hook : ${hook}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params === undefined) { // can't be simpler falsy check, empty strings can be passed e.g. filter:parse.raw
|
|
||||||
params = {};
|
|
||||||
}
|
|
||||||
if (typeof params === 'object') {
|
|
||||||
params._hook = Object.freeze({
|
|
||||||
name: hook,
|
|
||||||
type: hookType,
|
|
||||||
listeners: hookList && Array.isArray(hookList) ? hookList.length : 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const result = await hookTypeToMethod[hookType](hook, hookList, params);
|
const result = await hookTypeToMethod[hookType](hook, hookList, params);
|
||||||
|
|
||||||
if (hook !== 'action:plugins.firehook' && hook !== 'filter:plugins.firehook') {
|
if (hook !== 'action:plugins.firehook' && hook !== 'filter:plugins.firehook') {
|
||||||
|
|||||||
Reference in New Issue
Block a user