From 8a1bf9dc7f02f98a017e655533e0141360d1a03d Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Tue, 8 Jul 2014 10:21:18 +0530 Subject: [PATCH] fixed posts 404 implementation --- lib/router.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/router.js b/lib/router.js index ab899710a..7579df674 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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(); } },