mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 01:56:12 +01:00
fix missing callback
This commit is contained in:
@@ -14,17 +14,17 @@ module.exports = function(Plugins) {
|
||||
`data.priority`, the relative priority of the method when it is eventually called (default: 10)
|
||||
*/
|
||||
Plugins.registerHook = function(id, data, callback) {
|
||||
callback = callback || function() {};
|
||||
function register() {
|
||||
Plugins.loadedHooks[data.hook] = Plugins.loadedHooks[data.hook] || [];
|
||||
Plugins.loadedHooks[data.hook].push(data);
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
if (!data.hook) {
|
||||
return winston.warn('[plugins/' + id + '] registerHook called with invalid data.hook', data);
|
||||
winston.warn('[plugins/' + id + '] registerHook called with invalid data.hook', data);
|
||||
return callback();
|
||||
}
|
||||
|
||||
var method;
|
||||
@@ -69,6 +69,7 @@ module.exports = function(Plugins) {
|
||||
register();
|
||||
} else {
|
||||
winston.warn('[plugins/' + id + '] Hook method mismatch: ' + data.hook + ' => ' + data.method);
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user