mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 13:20:41 +01:00
feat: allow plugins to override tags and tag counts
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user