|
|
@ -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]['unread-class'] = (parseInt(categories[i].topic_count, 10) === 0 || (hasRead[i] && uid !== 0)) ? '' : 'unread';
|
|
|
|
categories[i].children = results.children[i];
|
|
|
|
categories[i].children = results.children[i];
|
|
|
|
categories[i].parent = results.parents[i] && !results.parents[i].disabled ? results.parents[i] : null;
|
|
|
|
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.getParents = function(cids, callback) {
|
|
|
|
Categories.getMultipleCategoryFields(cids, ['parentCid'], function(err, data) {
|
|
|
|
Categories.getMultipleCategoryFields(cids, ['parentCid'], function(err, data) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|