mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 18:56:15 +01:00
refactor: move plugin hook methods to plugin.hooks.*
This commit is contained in:
@@ -27,7 +27,7 @@ module.exports = function (Categories) {
|
||||
const translated = await translator.translate(modifiedFields.name);
|
||||
modifiedFields.slug = cid + '/' + slugify(translated);
|
||||
}
|
||||
const result = await plugins.fireHook('filter:category.update', { cid: cid, category: modifiedFields });
|
||||
const result = await plugins.hooks.fire('filter:category.update', { cid: cid, category: modifiedFields });
|
||||
|
||||
const category = result.category;
|
||||
var fields = Object.keys(category);
|
||||
@@ -40,7 +40,7 @@ module.exports = function (Categories) {
|
||||
await async.eachSeries(fields, async function (key) {
|
||||
await updateCategoryField(cid, key, category[key]);
|
||||
});
|
||||
plugins.fireHook('action:category.update', { cid: cid, modified: category });
|
||||
plugins.hooks.fire('action:category.update', { cid: cid, modified: category });
|
||||
}
|
||||
|
||||
async function updateCategoryField(cid, key, value) {
|
||||
@@ -92,7 +92,7 @@ module.exports = function (Categories) {
|
||||
}
|
||||
|
||||
Categories.parseDescription = async function (cid, description) {
|
||||
const parsedDescription = await plugins.fireHook('filter:parse.raw', description);
|
||||
const parsedDescription = await plugins.hooks.fire('filter:parse.raw', description);
|
||||
await Categories.setCategoryField(cid, 'descriptionParsed', parsedDescription);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user