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);
|
], next);
|
||||||
},
|
},
|
||||||
function(results, next) {
|
function(results, next) {
|
||||||
|
plugins.fireHook('action:category.create', category);
|
||||||
next(null, category);
|
next(null, category);
|
||||||
}
|
}
|
||||||
], callback);
|
], callback);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
var async = require('async'),
|
var async = require('async'),
|
||||||
db = require('../database'),
|
db = require('../database'),
|
||||||
batch = require('../batch'),
|
batch = require('../batch'),
|
||||||
|
plugins = require('../plugins'),
|
||||||
threadTools = require('../threadTools');
|
threadTools = require('../threadTools');
|
||||||
|
|
||||||
|
|
||||||
@@ -17,7 +18,10 @@ module.exports = function(Categories) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return callback(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);
|
var fields = Object.keys(category);
|
||||||
async.each(fields, function(key, next) {
|
async.each(fields, function(key, next) {
|
||||||
updateCategoryField(cid, key, category[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