mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: suggested topics showing up when last post not loaded
New fix means that was show suggested 1. If all posts are loaded 2. If we are in the process of loading 1 more post due to message bus
This commit is contained in:
parent
b30a90f7fe
commit
4ade6138d3
2 changed files with 7 additions and 18 deletions
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue