Sort replies descending as suggested here: nevent1qqsz8m3xjne7mkfgv0sqeqz432newpx34x3jxw2ly0sr8jn33pc4fuspzpmhxue69uhkummnw3ezuamfdejssfsmgv

This commit is contained in:
Jonathan Staab 2023-03-08 11:42:48 -06:00
parent ddcf5622b8
commit 02b617bbf1

View File

@ -1,5 +1,5 @@
import type {MyEvent} from 'src/util/types'
import {assoc, uniq, uniqBy, prop, propEq, reject, groupBy, pluck} from 'ramda'
import {sortBy, assoc, uniq, uniqBy, prop, propEq, reject, groupBy, pluck} from 'ramda'
import {personKinds, findReplyId} from 'src/util/nostr'
import {log} from 'src/util/logger'
import {chunk} from 'hurdak/lib/hurdak'
@ -188,7 +188,7 @@ const applyContext = (notes, context) => {
return {
...note,
replies: uniqBy(prop('id'), combinedReplies).map(annotate),
replies: sortBy(e => -e.created_at, uniqBy(prop('id'), combinedReplies).map(annotate)),
reactions: uniqBy(prop('id'), combinedReactions),
zaps: uniqBy(prop('id'), combinedZaps),
}