Skip to content

Node.js based forum software built for the modern web

backwards compatibility with plugins that are assuming no callback

Julian Lam19c9f1bb19ee
diff --git a/public/templates/.gitignore b/public/templates/.gitignore
deleted file mode 100644
index db3bf754ea..0000000000
--- a/public/templates/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.tpl
\ No newline at end of file
diff --git a/src/plugins.js b/src/plugins.js
index 1a9e4e3620..b10e762ca5 100644
--- a/src/plugins.js
+++ b/src/plugins.js
@@ -315,12 +315,17 @@ var fs = require('fs'),
case 'filter':
async.reduce(hookList, args, function(value, hookObj, next) {
if (hookObj.method) {
- if (hookObj.callbacked) {
- hookObj.method.apply(Plugins, value.concat(function() {
+ if (!hookObj.hasOwnProperty('callbacked') || hookObj.callbacked === true) {
+ var value = hookObj.method.apply(Plugins, value.concat(function() {
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 {
- 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);
next(null, [value]);
}