Change criteria to work out which posts are intended to be displayed

This commit is contained in:
Toby Zerner 2015-06-19 11:19:24 +09:30
parent 46347023cc
commit a714f12f8f

View File

@ -93,16 +93,11 @@ export default class DiscussionPage extends mixin(Component, evented) {
var includedPosts = [];
if (discussion.payload && discussion.payload.included) {
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.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 });