#2886 Check subcategories when showing category recent topics

This commit is contained in:
EvSpirit
2015-03-24 21:39:28 +03:00
parent 11710987a4
commit 0fcd4dee58
2 changed files with 3 additions and 2 deletions

View File

@@ -61,7 +61,8 @@ module.exports = function(Categories) {
function assignPostsToCategory(category, posts) {
category.posts = posts.filter(function(post) {
return post.category && parseInt(post.category.cid, 10) === parseInt(category.cid, 10);
return !!(post.category && (parseInt(post.category.cid, 10) === parseInt(category.cid, 10)
) || (parseInt(post.category.parentCid, 10) === parseInt(category.cid, 10)));
}).sort(function(a, b) {
return b.timestamp - a.timestamp;
}).slice(0, parseInt(category.numRecentReplies, 10));