mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 05:52:49 +08:00
FIX: Placeholders were missing when scrolling downwards
This commit is contained in:
parent
cd412976d7
commit
bd967ba38c
|
@ -144,6 +144,8 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
|
||||
if (lastLoadedPost && lastLoadedPost === post) {
|
||||
postStream.appendMore().then(() => refresh());
|
||||
// show loading stuff
|
||||
refresh();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ export default {
|
|||
// TODO: Use ember closure actions
|
||||
const result = topicController._actions[action].call(topicController, post);
|
||||
if (result && result.then) {
|
||||
this.appEvents.trigger('post-stream:refresh', selectedPostId)
|
||||
this.appEvents.trigger('post-stream:refresh', selectedPostId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<article class='placeholder'>
|
||||
<div class='row'>
|
||||
<div class="topic-avatar">
|
||||
<div class='placeholder-avatar'></div>
|
||||
</div>
|
||||
|
||||
<div class='topic-body'>
|
||||
<div class='placeholder-text'></div>
|
||||
<div class='placeholder-text'></div>
|
||||
<div class='placeholder-text'></div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
|
@ -1 +0,0 @@
|
|||
export default Ember.View.extend({ templateName: 'post-placeholder' });
|
|
@ -0,0 +1,17 @@
|
|||
import { createWidget } from 'discourse/widgets/widget';
|
||||
import { h } from 'virtual-dom';
|
||||
|
||||
export default createWidget('post-placeholder', {
|
||||
tagName: 'article.placeholder',
|
||||
|
||||
html() {
|
||||
return h('div.row', [
|
||||
h('div.topic-avatar', h('div.placeholder-avatar')),
|
||||
h('div.topic-body', [
|
||||
h('div.placeholder-text'),
|
||||
h('div.placeholder-text'),
|
||||
h('div.placeholder-text')
|
||||
])
|
||||
]);
|
||||
}
|
||||
});
|
|
@ -1,5 +1,6 @@
|
|||
import { createWidget } from 'discourse/widgets/widget';
|
||||
import transformPost from 'discourse/lib/transform-post';
|
||||
import { Placeholder } from 'discourse/lib/posts-with-placeholders';
|
||||
|
||||
const DAY = 1000 * 60 * 60 * 24;
|
||||
|
||||
|
@ -21,6 +22,12 @@ export default createWidget('post-stream', {
|
|||
|
||||
for (let i=0; i<postArray.length; i++) {
|
||||
const post = postArray[i];
|
||||
|
||||
if (post instanceof Placeholder) {
|
||||
result.push(this.attach('post-placeholder'));
|
||||
continue;
|
||||
}
|
||||
|
||||
const nextPost = (i < postArray.length - 1) ? postArray[i+i] : null;
|
||||
|
||||
const transformed = transformPost(this.currentUser, this.site, post, prevPost, nextPost);
|
||||
|
|
Loading…
Reference in New Issue
Block a user