mirror of
https://github.com/flarum/core.git
synced 2025-07-28 12:10:51 +02:00
Sort included posts
They can be out of order in the payload due to relationship loading, e.g. post #1 includes post #14 that has mentioned it, therefore #14 will be the first post in the payload. The new post stream doesn’t take kindly to out of order posts.
This commit is contained in:
@@ -82,6 +82,7 @@ export default class DiscussionPage extends mixin(Component, evented) {
|
|||||||
includedPosts.push(app.store.getById('posts', record.id));
|
includedPosts.push(app.store.getById('posts', record.id));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
includedPosts.sort((a, b) => a.id() - b.id());
|
||||||
|
|
||||||
this.stream = new PostStream({ discussion, includedPosts });
|
this.stream = new PostStream({ discussion, includedPosts });
|
||||||
this.stream.on('positionChanged', this.positionChanged.bind(this));
|
this.stream.on('positionChanged', this.positionChanged.bind(this));
|
||||||
|
Reference in New Issue
Block a user