mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
more category hooks
This commit is contained in:
@@ -54,6 +54,7 @@ module.exports = function(Categories) {
|
||||
], next);
|
||||
},
|
||||
function(results, next) {
|
||||
plugins.fireHook('action:category.create', category);
|
||||
next(null, category);
|
||||
}
|
||||
], callback);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
var async = require('async'),
|
||||
db = require('../database'),
|
||||
batch = require('../batch'),
|
||||
plugins = require('../plugins'),
|
||||
threadTools = require('../threadTools');
|
||||
|
||||
|
||||
@@ -17,7 +18,10 @@ module.exports = function(Categories) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
purgeCategory(cid, callback);
|
||||
async.series([
|
||||
async.apply(purgeCategory, cid),
|
||||
async.apply(plugins.fireHook, 'action:category.delete', cid)
|
||||
], callback);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,13 @@ module.exports = function(Categories) {
|
||||
var fields = Object.keys(category);
|
||||
async.each(fields, function(key, next) {
|
||||
updateCategoryField(cid, key, category[key], next);
|
||||
}, next);
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
plugins.fireHook('action:category.update', {cid: cid, modified: category});
|
||||
next();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user