mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 09:15:33 +03:00
More sort, still not perfect
This proves to be more difficult than I thought
This commit is contained in:
parent
6fcbc9dfa4
commit
edf7f6039c
1 changed files with 6 additions and 3 deletions
|
@ -119,9 +119,12 @@ export function groupContext(items) {
|
|||
// Sort items by checking inReplyToId
|
||||
contexts.forEach((context) => {
|
||||
context.sort((a, b) => {
|
||||
if (a.inReplyToId === b.id) return 1;
|
||||
if (b.inReplyToId === a.id) return -1;
|
||||
return 0;
|
||||
if (!a.inReplyToId && !b.inReplyToId) {
|
||||
return new Date(a.createdAt) - new Date(b.createdAt);
|
||||
}
|
||||
if (!a.inReplyToId) return -1;
|
||||
if (!b.inReplyToId) return 1;
|
||||
return new Date(a.createdAt) - new Date(b.createdAt);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue