mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 03:51:26 +01:00
closes #3062
This commit is contained in:
@@ -241,6 +241,7 @@ var async = require('async'),
|
||||
categories[i]['unread-class'] = (parseInt(categories[i].topic_count, 10) === 0 || (hasRead[i] && uid !== 0)) ? '' : 'unread';
|
||||
categories[i].children = results.children[i];
|
||||
categories[i].parent = results.parents[i] && !results.parents[i].disabled ? results.parents[i] : null;
|
||||
calculateTopicPostCount(categories[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,6 +249,17 @@ var async = require('async'),
|
||||
});
|
||||
};
|
||||
|
||||
function calculateTopicPostCount(category) {
|
||||
if (!Array.isArray(category.children) || !category.children.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
category.children.forEach(function(child) {
|
||||
});
|
||||
category.post_count = postCount;
|
||||
category.topic_count = topicCount;
|
||||
}
|
||||
|
||||
Categories.getParents = function(cids, callback) {
|
||||
Categories.getMultipleCategoryFields(cids, ['parentCid'], function(err, data) {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user