Skip to content

Node.js based forum software built for the modern web

feat: allow plugins to override tags and tag counts

Julian Lam81595095da9e
diff --git a/src/topics/tags.js b/src/topics/tags.js
index db49719e14..4f544d09c5 100644
--- a/src/topics/tags.js
+++ b/src/topics/tags.js
@@ -109,11 +109,15 @@ module.exports = function (Topics) {
}
Topics.getTagTids = async function (tag, start, stop) {
- return await db.getSortedSetRevRange('tag:' + tag + ':topics', start, stop);
+ const tids = await db.getSortedSetRevRange('tag:' + tag + ':topics', start, stop);
+ const payload = await plugins.fireHook('filter:topics.getTagTids', { tag, start, stop, tids });
+ return payload.tids;
};
Topics.getTagTopicCount = async function (tag) {
- return await db.sortedSetCard('tag:' + tag + ':topics');
+ const count = await db.sortedSetCard('tag:' + tag + ':topics');
+ const payload = await plugins.fireHook('filter:topics.getTagTopicCount', { tag, count });
+ return payload.count;
};
Topics.deleteTags = async function (tags) {