Skip to content

Node.js based forum software built for the modern web

added postcount to topic

barisusaklia69eafd9f7aa
diff --git a/src/categories.js b/src/categories.js
index 7263d068c6..eb65878864 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -171,7 +171,9 @@ var async = require('async'),
category.name = validator.escape(category.name);
category.disabled = parseInt(category.disabled, 10) === 1;
category.icon = category.icon || 'hidden';
- category.post_count = category.post_count || 0;
+ if (category.hasOwnProperty('post_count')) {
+ category.post_count = category.post_count || 0;
+ }
if (category.description) {
category.description = validator.escape(category.description);
diff --git a/src/posts/summary.js b/src/posts/summary.js
index 463298f0c3..dd537ce8d6 100644
--- a/src/posts/summary.js
+++ b/src/posts/summary.js
@@ -105,7 +105,7 @@ module.exports = function(Posts) {
};
function getTopicAndCategories(topicKeys, callback) {
- db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted'], function(err, topics) {
+ db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount'], function(err, topics) {
if (err) {
return callback(err);
}