more category hooks

v1.18.x
barisusakli 10 years ago
parent abfd58a1a9
commit dff1a04585

@ -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();
});
});
});
}

Loading…
Cancel
Save