mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: postChangedRoute
was firing after destruction sometimes
This commit is contained in:
parent
bad9835120
commit
81a0b25324
@ -122,7 +122,9 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||||||
const postStream = this.get('model.postStream');
|
const postStream = this.get('model.postStream');
|
||||||
const firstLoadedPost = postStream.get('posts.firstObject');
|
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; }
|
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) {
|
readPosts(topicId, postNumbers) {
|
||||||
const topic = this.get("model"),
|
const topic = this.get("model"),
|
||||||
postStream = topic.get("postStream");
|
postStream = topic.get("postStream");
|
||||||
|
Loading…
Reference in New Issue
Block a user