mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
backwards compatibility with plugins that are assuming no callback
This commit is contained in:
1
public/templates/.gitignore
vendored
1
public/templates/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
*.tpl
|
|
||||||
@@ -315,12 +315,17 @@ var fs = require('fs'),
|
|||||||
case 'filter':
|
case 'filter':
|
||||||
async.reduce(hookList, args, function(value, hookObj, next) {
|
async.reduce(hookList, args, function(value, hookObj, next) {
|
||||||
if (hookObj.method) {
|
if (hookObj.method) {
|
||||||
if (hookObj.callbacked) {
|
if (!hookObj.hasOwnProperty('callbacked') || hookObj.callbacked === true) {
|
||||||
hookObj.method.apply(Plugins, value.concat(function() {
|
var value = hookObj.method.apply(Plugins, value.concat(function() {
|
||||||
next(arguments[0], Array.prototype.slice.call(arguments, 1));
|
next(arguments[0], Array.prototype.slice.call(arguments, 1));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (value !== undefined) {
|
||||||
|
winston.warn('[plugins/' + hookObj.id + '] "callbacked" deprecated as of 0.4x. Use asynchronous method instead for hook: ' + hook);
|
||||||
|
next(null, [value]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
winston.warn('[plugins] "callbacked" deprecated as of 0.4x. Use asynchronous method instead for hook: ' + hook);
|
winston.warn('[plugins/' + hookObj.id + '] "callbacked" deprecated as of 0.4x. Use asynchronous method instead for hook: ' + hook);
|
||||||
value = hookObj.method.apply(Plugins, value);
|
value = hookObj.method.apply(Plugins, value);
|
||||||
next(null, [value]);
|
next(null, [value]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user