mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
feat: expose calculateTopicPostCount and getChildrenTree
This commit is contained in:
@@ -188,6 +188,7 @@ function calculateTopicPostCount(category) {
|
|||||||
category.totalPostCount = postCount;
|
category.totalPostCount = postCount;
|
||||||
category.totalTopicCount = topicCount;
|
category.totalTopicCount = topicCount;
|
||||||
}
|
}
|
||||||
|
Categories.calculateTopicPostCount = calculateTopicPostCount;
|
||||||
|
|
||||||
Categories.getParents = async function (cids) {
|
Categories.getParents = async function (cids) {
|
||||||
const categoriesData = await Categories.getCategoriesFields(cids, ['parentCid']);
|
const categoriesData = await Categories.getCategoriesFields(cids, ['parentCid']);
|
||||||
@@ -225,6 +226,8 @@ async function getChildrenTree(category, uid) {
|
|||||||
Categories.getTree([category].concat(childrenData), category.parentCid);
|
Categories.getTree([category].concat(childrenData), category.parentCid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Categories.getChildrenTree = getChildrenTree;
|
||||||
|
|
||||||
Categories.getChildrenCids = async function (rootCid) {
|
Categories.getChildrenCids = async function (rootCid) {
|
||||||
let allCids = [];
|
let allCids = [];
|
||||||
async function recursive(keys) {
|
async function recursive(keys) {
|
||||||
|
|||||||
Reference in New Issue
Block a user