mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
firing new third type of hook, static. New hook: static:app.load, closed #1812
This commit is contained in:
@@ -357,19 +357,6 @@ var fs = require('fs'),
|
||||
var hookType = hook.split(':')[0];
|
||||
switch (hookType) {
|
||||
case 'filter':
|
||||
if (hook === 'filter:app.load') {
|
||||
// Special case for this hook, as arguments passed in are always the same
|
||||
async.each(hookList, function(hookObj, next) {
|
||||
if (hookObj.method) {
|
||||
hookObj.method.apply(Plugins, args.concat(next));
|
||||
}
|
||||
}, function(err) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
async.reduce(hookList, args, function(value, hookObj, next) {
|
||||
if (hookObj.method) {
|
||||
if (!hookObj.hasOwnProperty('callbacked') || hookObj.callbacked === true) {
|
||||
@@ -417,7 +404,7 @@ var fs = require('fs'),
|
||||
async.each(hookList, function(hookObj, next) {
|
||||
/*
|
||||
Backwards compatibility block for v0.5.0
|
||||
Remove this once NodeBB enters v0.5.0-1
|
||||
Remove this once NodeBB enters v0.6.0-1
|
||||
*/
|
||||
if (hook === 'action:app.load') {
|
||||
deprecationWarn.push(hookObj.id);
|
||||
@@ -436,10 +423,10 @@ var fs = require('fs'),
|
||||
}, function() {
|
||||
/*
|
||||
Backwards compatibility block for v0.5.0
|
||||
Remove this once NodeBB enters v0.5.0-1
|
||||
Remove this once NodeBB enters v0.6.0-1
|
||||
*/
|
||||
if (deprecationWarn.length) {
|
||||
winston.warn('[plugins] The `action:app.load` hook is deprecated in favour of `filter:app.load`, please notify the developers of the following plugins:');
|
||||
winston.warn('[plugins] The `action:app.load` hook is deprecated in favour of `static:app.load`, please notify the developers of the following plugins:');
|
||||
for(var x=0,numDeprec=deprecationWarn.length;x<numDeprec;x++) {
|
||||
process.stdout.write(' * ' + deprecationWarn[x] + '\n');
|
||||
}
|
||||
@@ -447,6 +434,15 @@ var fs = require('fs'),
|
||||
/* End backwards compatibility block */
|
||||
});
|
||||
break;
|
||||
case 'static':
|
||||
async.each(hookList, function(hookObj, next) {
|
||||
if (hookObj.method) {
|
||||
hookObj.method.apply(Plugins, args.concat(next));
|
||||
}
|
||||
}, function(err) {
|
||||
callback(err);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
// Do nothing...
|
||||
break;
|
||||
@@ -730,7 +726,7 @@ var fs = require('fs'),
|
||||
var components = lang.route.split('/'),
|
||||
language = components[1],
|
||||
filename = components[2].replace('.json', '');
|
||||
|
||||
|
||||
translator.addTranslation(language, filename, lang.file);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user