mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
closes #3447
recursively get all children calculate topic/post count from children new sorted set `cid:<id>:children` fix search query params
This commit is contained in:
@@ -33,7 +33,7 @@ categoriesController.list = function(req, res, next) {
|
||||
content: 'website'
|
||||
}];
|
||||
|
||||
if(meta.config['brand:logo']) {
|
||||
if (meta.config['brand:logo']) {
|
||||
res.locals.metaTags.push({
|
||||
property: 'og:image',
|
||||
content: meta.config['brand:logo']
|
||||
@@ -46,22 +46,13 @@ categoriesController.list = function(req, res, next) {
|
||||
var categoryData;
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
categories.getCategoriesByPrivilege(req.uid, 'find', next);
|
||||
categories.getCategoriesByPrivilege('cid:0:children', req.uid, 'find', next);
|
||||
},
|
||||
function(_categoryData, next) {
|
||||
categoryData = _categoryData;
|
||||
|
||||
var allCategories = [];
|
||||
|
||||
categoryData = categoryData.filter(function(category) {
|
||||
if (!category.parent) {
|
||||
allCategories.push(category);
|
||||
}
|
||||
|
||||
if (Array.isArray(category.children) && category.children.length) {
|
||||
allCategories.push.apply(allCategories, category.children);
|
||||
}
|
||||
return category && !category.parent;
|
||||
});
|
||||
categories.flattenCategories(allCategories, categoryData);
|
||||
|
||||
categories.getRecentTopicReplies(allCategories, req.uid, next);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user