mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
18 lines
No EOL
632 B
JavaScript
18 lines
No EOL
632 B
JavaScript
import Posts from "meteor/nova:posts";
|
|
|
|
Meteor.publish('categories', function() {
|
|
if(Users.can.viewById(this.userId)){
|
|
var categories = Categories.find();
|
|
var publication = this;
|
|
|
|
categories.forEach(function (category) {
|
|
var childrenCategories = category.getChildren();
|
|
var categoryIds = [category._id].concat(_.pluck(childrenCategories, "_id"));
|
|
var cursor = Posts.find({$and: [{categories: {$in: categoryIds}}, {status: Posts.config.STATUS_APPROVED}]});
|
|
// Counts.publish(publication, category.getCounterName(), cursor, { noReady: true });
|
|
});
|
|
|
|
return categories;
|
|
}
|
|
return [];
|
|
}); |