refactor: move plugin hook methods to plugin.hooks.*

This commit is contained in:
Julian Lam
2020-11-20 16:06:26 -05:00
parent 3b1c03ed50
commit 6e2da9966e
136 changed files with 550 additions and 541 deletions

View File

@@ -36,7 +36,7 @@ module.exports = function (Categories) {
if (numRecentReplies > 0) {
await db.sortedSetAdd('cid:' + cid + ':recent_tids', Date.now(), tid);
}
await plugins.fireHook('action:categories.updateRecentTid', { cid: cid, tid: tid });
await plugins.hooks.fire('action:categories.updateRecentTid', { cid: cid, tid: tid });
};
Categories.updateRecentTidForCid = async function (cid) {
@@ -68,8 +68,8 @@ module.exports = function (Categories) {
}
const categoriesToLoad = categoryData.filter(c => c && c.numRecentReplies && parseInt(c.numRecentReplies, 10) > 0);
let keys = [];
if (plugins.hasListeners('filter:categories.getRecentTopicReplies')) {
const result = await plugins.fireHook('filter:categories.getRecentTopicReplies', {
if (plugins.hooks.hasListeners('filter:categories.getRecentTopicReplies')) {
const result = await plugins.hooks.fire('filter:categories.getRecentTopicReplies', {
categories: categoriesToLoad,
uid: uid,
query: query,