mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-26 03:05:41 +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
|
// Sort items by checking inReplyToId
|
||||||
contexts.forEach((context) => {
|
contexts.forEach((context) => {
|
||||||
context.sort((a, b) => {
|
context.sort((a, b) => {
|
||||||
if (a.inReplyToId === b.id) return 1;
|
if (!a.inReplyToId && !b.inReplyToId) {
|
||||||
if (b.inReplyToId === a.id) return -1;
|
return new Date(a.createdAt) - new Date(b.createdAt);
|
||||||
return 0;
|
}
|
||||||
|
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