mirror of
https://github.com/flarum/framework.git
synced 2025-02-07 20:56:14 +08:00
order posts by creation date
This commit is contained in:
parent
a8c52bc3df
commit
ae01ea679b
|
@ -155,7 +155,7 @@ export default class DiscussionPage extends Page {
|
|||
record.relationships.discussion.data.id === discussionId
|
||||
)
|
||||
.map((record) => app.store.getById('posts', record.id))
|
||||
.sort((a, b) => a.id() - b.id())
|
||||
.sort((a, b) => a.createdAt() - b.createdAt())
|
||||
.slice(0, 20);
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ class PostStreamState {
|
|||
|
||||
if (loadIds.length) {
|
||||
return app.store.find('posts', loadIds).then((newPosts) => {
|
||||
return loaded.concat(newPosts).sort((a, b) => a.id() - b.id());
|
||||
return loaded.concat(newPosts).sort((a, b) => a.createdAt() - b.createdAt());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user