Skip to content

Node.js based forum software built for the modern web

closes #3062

barisusaklic24dce4dd671
diff --git a/src/categories.js b/src/categories.js
index 9bcb78f025..d1621921f0 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -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) {