mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 19:11:38 -05:00
Merge branch 'subs-manager' of github.com:arunoda/Telescope into arunoda-subs-manager
Conflicts: lib/router.js
This commit is contained in:
commit
87378ec656
2 changed files with 12 additions and 12 deletions
|
@ -358,11 +358,9 @@ PostsDigestController = FastRender.RouteController.extend({
|
|||
|
||||
PostPageController = FastRender.RouteController.extend({
|
||||
waitOn: function() {
|
||||
return [
|
||||
coreSubscriptions.subscribe('singlePost', this.params._id),
|
||||
coreSubscriptions.subscribe('postComments', this.params._id),
|
||||
coreSubscriptions.subscribe('postUsers', this.params._id)
|
||||
];
|
||||
this.postSubscription = coreSubscriptions.subscribe('singlePost', this.params._id);
|
||||
this.commentSubscription = coreSubscriptions.subscribe('postComments', this.params._id);
|
||||
this.postUsersSubscription = coreSubscriptions.subscribe('postUsers', this.params._id);
|
||||
},
|
||||
|
||||
post: function() {
|
||||
|
@ -370,11 +368,14 @@ PostPageController = FastRender.RouteController.extend({
|
|||
},
|
||||
|
||||
onBeforeAction: function(pause) {
|
||||
if (this.ready()) {
|
||||
if(!this.post()) {
|
||||
if (! this.post()) {
|
||||
if (this.postSubscription.ready()) {
|
||||
this.render('not_found');
|
||||
return pause();
|
||||
}
|
||||
|
||||
this.render('loading');
|
||||
pause();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ Meteor.publish('postUsers', function(postId) {
|
|||
// publish post author and post commenters
|
||||
var post = Posts.findOne(postId),
|
||||
users = [];
|
||||
|
||||
|
||||
if(post) {
|
||||
var comments = Comments.find({postId: post._id}).fetch();
|
||||
// get IDs from all commenters on the post, plus post author's ID
|
||||
|
@ -49,7 +49,7 @@ Meteor.publish('postUsers', function(postId) {
|
|||
users.push(post.userId);
|
||||
users = _.unique(users);
|
||||
}
|
||||
|
||||
|
||||
return Meteor.users.find({_id: {$in: users}}, {fields: privacyOptions});
|
||||
}
|
||||
return [];
|
||||
|
@ -84,7 +84,7 @@ Meteor.publish('allUsers', function(filterBy, sortBy, limit) {
|
|||
var parameters = getUsersParameters(filterBy, sortBy, limit);
|
||||
if (!isAdminById(this.userId)) // if user is not admin, filter out sensitive info
|
||||
parameters.options = _.extend(parameters.options, {fields: privacyOptions});
|
||||
return Meteor.users.find(parameters.find, parameters.options);
|
||||
return Meteor.users.find(parameters.find, parameters.options);
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
@ -144,7 +144,7 @@ Meteor.publish('postsList', function(terms) {
|
|||
// Publish comments for a specific post
|
||||
|
||||
Meteor.publish('postComments', function(postId) {
|
||||
if(canViewById(this.userId)){
|
||||
if(canViewById(this.userId)){
|
||||
return Comments.find({postId: postId});
|
||||
}
|
||||
return [];
|
||||
|
@ -181,4 +181,3 @@ Meteor.publish('notifications', function() {
|
|||
}
|
||||
return [];
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue