mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
Change criteria to work out which posts are intended to be displayed
This commit is contained in:
parent
a45729805d
commit
63ea9f0891
|
@ -93,16 +93,11 @@ export default class DiscussionPage extends mixin(Component, evented) {
|
||||||
var includedPosts = [];
|
var includedPosts = [];
|
||||||
if (discussion.payload && discussion.payload.included) {
|
if (discussion.payload && discussion.payload.included) {
|
||||||
discussion.payload.included.forEach(record => {
|
discussion.payload.included.forEach(record => {
|
||||||
if (record.type === 'posts' && (record.contentType !== 'comment' || record.contentHtml)) {
|
if (record.type === 'posts' && record.links && record.links.discussion) {
|
||||||
includedPosts.push(app.store.getById('posts', record.id));
|
includedPosts.push(app.store.getById('posts', record.id));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
includedPosts.sort((a, b) => a.id() - b.id());
|
includedPosts.sort((a, b) => a.id() - b.id());
|
||||||
} else {
|
|
||||||
var posts = discussion.posts();
|
|
||||||
if (posts) {
|
|
||||||
includedPosts = posts.filter(post => post);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stream = new PostStream({ discussion, includedPosts });
|
this.stream = new PostStream({ discussion, includedPosts });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user