Skip to content

Commit

Permalink
feat: allow plugins to override tags and tag counts
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Sep 22, 2020
1 parent 445a840 commit 8159509
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/topics/tags.js
Expand Up @@ -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) {
Expand Down

0 comments on commit 8159509

Please sign in to comment.