Skip to content

Node.js based forum software built for the modern web

default to zero if post_count topic_count is falsy

barisusakli50feb7a76636
diff --git a/src/categories.js b/src/categories.js
index d1621921f0..6112c5dc58 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -253,8 +253,12 @@ var async = require('async'),
if (!Array.isArray(category.children) || !category.children.length) {
return;
}
+ var postCount = parseInt(category.post_count, 10) || 0;
+ var topicCount = parseInt(category.topic_count, 10) || 0;
category.children.forEach(function(child) {
+ postCount += parseInt(child.post_count, 10) || 0;
+ topicCount += parseInt(child.topic_count, 10) || 0;
});
category.post_count = postCount;
category.topic_count = topicCount;