FIX: Don't show placeholder when triggering one post

This commit is contained in:
Robin Ward 2015-12-07 14:20:42 -05:00
parent 8f1937e88f
commit 467485cf47
2 changed files with 7 additions and 3 deletions

View File

@ -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 () {

View File

@ -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 => {
@ -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);
});
}
}
},