diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 70f3a967a..8a6c7b228 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -15,7 +15,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, { selectedPosts: null, selectedReplies: null, queryParams: ['filter', 'username_filters', 'show_deleted'], - loadedAllPosts: false, + loadedAllPosts: Em.computed.or('model.postStream.loadedAllPosts', 'model.postStream.loadingLastPost'), enteredAt: null, firstPostExpanded: false, retrying: false, @@ -36,22 +36,6 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, { } }.observes('model.title', 'category'), - postStreamLoadedAllPostsChanged: function() { - // semantics of loaded all posts are slightly diff at topic level, - // it just means that we "once" loaded all posts, this means we don't - // keep re-rendering the suggested topics when new posts zoom in - let loaded = this.get('model.postStream.loadedAllPosts'); - - if (loaded) { - this.set('model.loadedTopicId', this.get('model.id')); - } else { - loaded = this.get('model.loadedTopicId') === this.get('model.id'); - } - - this.set('loadedAllPosts', loaded); - - }.observes('model.postStream', 'model.postStream.loadedAllPosts'), - @computed('model.postStream.summary') show_deleted: { set(value) { diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6 index d810723ac..010330451 100644 --- a/app/assets/javascripts/discourse/models/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/post-stream.js.es6 @@ -464,7 +464,12 @@ const PostStream = RestModel.extend({ if (this.get('stream').indexOf(postId) === -1) { this.get('stream').addObject(postId); - if (loadedAllPosts) { this.appendMore(); } + if (loadedAllPosts) { + this.set('loadingLastPost', true); + this.appendMore().finally( + ()=>this.set('loadingLastPost', true) + ); + } } },