mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 06:03:39 +08:00
Only render posts with the discussion relationship
This commit is contained in:
parent
03029c84dc
commit
ae18e30063
|
@ -167,7 +167,11 @@ class PostStream extends mixin(Component, evented) {
|
||||||
posts() {
|
posts() {
|
||||||
return this.discussion.postIds()
|
return this.discussion.postIds()
|
||||||
.slice(this.visibleStart, this.visibleEnd)
|
.slice(this.visibleStart, this.visibleEnd)
|
||||||
.map(id => app.store.getById('posts', id));
|
.map(id => {
|
||||||
|
const post = app.store.getById('posts', id);
|
||||||
|
|
||||||
|
return post && post.discussion() ? post : null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
view() {
|
view() {
|
||||||
|
@ -365,10 +369,10 @@ class PostStream extends mixin(Component, evented) {
|
||||||
this.discussion.postIds().slice(start, end).forEach(id => {
|
this.discussion.postIds().slice(start, end).forEach(id => {
|
||||||
const post = app.store.getById('posts', id);
|
const post = app.store.getById('posts', id);
|
||||||
|
|
||||||
if (!post) {
|
if (post && post.discussion()) {
|
||||||
loadIds.push(id);
|
|
||||||
} else {
|
|
||||||
loaded.push(post);
|
loaded.push(post);
|
||||||
|
} else {
|
||||||
|
loadIds.push(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user