1
0
mirror of https://github.com/flarum/core.git synced 2025-07-09 19:06:23 +02:00

order posts by creation date

This commit is contained in:
Wadim Kalmykov
2020-10-13 21:33:50 +07:00
committed by Alexander Skvortsov
parent 7634a766cb
commit d460aaa3ad
2 changed files with 2 additions and 2 deletions

View File

@ -155,7 +155,7 @@ export default class DiscussionPage extends Page {
record.relationships.discussion.data.id === discussionId record.relationships.discussion.data.id === discussionId
) )
.map((record) => app.store.getById('posts', record.id)) .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); .slice(0, 20);
} }

View File

@ -284,7 +284,7 @@ class PostStreamState {
if (loadIds.length) { if (loadIds.length) {
return app.store.find('posts', loadIds).then((newPosts) => { 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());
}); });
} }