FIX: `postChangedRoute` was firing after destruction sometimes

This commit is contained in:
Robin Ward 2016-02-08 12:48:48 -05:00
parent bad9835120
commit 81a0b25324
1 changed files with 3 additions and 9 deletions

View File

@ -122,7 +122,9 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
const postStream = this.get('model.postStream');
const firstLoadedPost = postStream.get('posts.firstObject');
this.set('model.currentPost', post.get('post_number'));
const currentPostNumber = post.get('post_number');
this.set('model.currentPost', currentPostNumber);
this.send('postChangedRoute', currentPostNumber);
if (post.get('post_number') === 1) { return; }
@ -712,14 +714,6 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
}
},
// If our current post is changed, notify the router
_currentPostChanged: function() {
const currentPost = this.get('model.currentPost');
if (currentPost) {
this.send('postChangedRoute', currentPost);
}
}.observes('model.currentPost'),
readPosts(topicId, postNumbers) {
const topic = this.get("model"),
postStream = topic.get("postStream");