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) {