fixed posts 404 implementation

This commit is contained in:
Arunoda Susiripala 2014-07-08 10:21:18 +05:30
parent 10e38bc455
commit 8a1bf9dc7f

View file

@ -357,10 +357,12 @@ PostsDigestController = FastRender.RouteController.extend({
// Controller for post pages
PostPageController = FastRender.RouteController.extend({
loadSubscriptions: function() {
this.postSubscription = coreSubscriptions.subscribe('singlePost', this.params._id);
this.commentSubscription = coreSubscriptions.subscribe('postComments', this.params._id);
this.postUsersSubscription = coreSubscriptions.subscribe('postUsers', this.params._id);
waitOn: function() {
return [
coreSubscriptions.subscribe('singlePost', this.params._id),
coreSubscriptions.subscribe('postComments', this.params._id),
coreSubscriptions.subscribe('postUsers', this.params._id)
];
},
post: function() {
@ -368,16 +370,11 @@ PostPageController = FastRender.RouteController.extend({
},
onBeforeAction: function(pause) {
this.loadSubscriptions();
if (! this.post()) {
if (this.postSubscription.ready()) {
this.render('notFound');
if (this.ready()) {
if(!this.post()) {
this.render('not_found');
return pause();
}
this.render('loading');
pause();
}
},