mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
19 lines
525 B
JavaScript
19 lines
525 B
JavaScript
import Users from 'meteor/nova:users';
|
|
|
|
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}}
|
|
};
|
|
});
|
|
}
|