Skip to content

Commit

Permalink
FIX: Don't show placeholder when triggering one post
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltrout committed Dec 7, 2015
1 parent 8f1937e commit 467485c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/assets/javascripts/discourse/controllers/topic.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,8 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
const $body = $('body');
const elemId = `#post_${post.get('post_number')}`;
const $elem = $(elemId).closest('.post-cloak');
const distToElement = $body.scrollTop() - $elem.position().top;
const elemPos = $elem.position();
const distToElement = elemPos ? $body.scrollTop() - elemPos.top : 0;

postStream.prependMore().then(function() {
Em.run.next(function () {
Expand Down
7 changes: 5 additions & 2 deletions app/assets/javascripts/discourse/models/post-stream.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ export default RestModel.extend({
if (Ember.isEmpty(postIds)) { return Ember.RSVP.resolve(); }

this.set('loadingBelow', true);

const postsWithPlaceholders = this.get('postsWithPlaceholders');
postsWithPlaceholders.appending(postIds);
return this.findPostsByIds(postIds).then(posts => {
Expand Down Expand Up @@ -483,7 +482,11 @@ export default RestModel.extend({
this.get('stream').addObject(postId);
if (loadedAllPosts) {
this.set('loadingLastPost', true);
this.appendMore().finally(()=> this.set('loadingLastPost', true));
this.findPostsByIds([postId]).then(posts => {
posts.forEach(p => this.appendPost(p));
}).finally(() => {
this.set('loadingLastPost', false);
});
}
}
},
Expand Down

0 comments on commit 467485c

Please sign in to comment.