mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 04:16:37 -04:00
17 lines
485 B
JavaScript
17 lines
485 B
JavaScript
if (typeof Package['nova:posts'] !== "undefined") {
|
|
import Posts from "meteor/nova:posts";
|
|
|
|
Posts.views.add("userSubscribedPosts", function (terms) {
|
|
var user = Users.findOne(terms.userId),
|
|
postsIds = [];
|
|
|
|
if (user && user.__subscribedItems && user.__subscribedItems.Posts) {
|
|
postsIds = _.pluck(user.__subscribedItems.Posts, "itemId");
|
|
}
|
|
|
|
return {
|
|
selector: {_id: {$in: postsIds}},
|
|
options: {limit: 5, sort: {postedAt: -1}}
|
|
};
|
|
});
|
|
}
|