diff --git a/framework/core/js/forum/src/components/DiscussionPage.js b/framework/core/js/forum/src/components/DiscussionPage.js index bc73a8a46..771004b17 100644 --- a/framework/core/js/forum/src/components/DiscussionPage.js +++ b/framework/core/js/forum/src/components/DiscussionPage.js @@ -172,8 +172,13 @@ export default class DiscussionPage extends Page { // the 'discussion' relationship linked, then sorting and splicing. let includedPosts = []; if (discussion.payload && discussion.payload.included) { + const discussionId = discussion.id(); + includedPosts = discussion.payload.included - .filter(record => record.type === 'posts' && record.relationships && record.relationships.discussion) + .filter(record => record.type === 'posts' + && record.relationships + && record.relationships.discussion + && record.relationships.discussion.data.id === discussionId) .map(record => app.store.getById('posts', record.id)) .sort((a, b) => a.id() - b.id()) .slice(0, 20);