feat: allow plugins to override tags and tag counts

v1.18.x
Julian Lam 4 years ago
parent 445a840b88
commit 81595095da

@ -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) {

Loading…
Cancel
Save