groups: fix notification order

This commit is contained in:
Patrick O'Sullivan 2022-03-28 14:52:28 -05:00
parent a38d5db9e3
commit 952a05a901

View File

@ -66,7 +66,7 @@ export function Notification(props: {
const key = `${harkLidToId(lid)}-${harkBinToId(notification.bin)}`;
const history = useHistory();
const isMobile = useLocalState((s) => s.mobile);
const isMobile = useLocalState(s => s.mobile);
const onArchive = useCallback(
async (e) => {
@ -80,8 +80,10 @@ export function Notification(props: {
);
const { hovering, bind } = useHovering();
const dedupedBody = uniqBy(notification.body, (item) => item.link);
const contents = map(dedupedBody, 'content').filter((c) => c.length > 0);
const dedupedBody = uniqBy(notification.body, item => item.link);
// @ts-ignore TODO fix HarkBody definition for time, is string, should be number.
const orderedByTime = dedupedBody.sort((a, b) => b.time - a.time);
const contents = map(orderedByTime, 'content').filter(c => c.length > 0);
const first = notification.body[0];
if (!first) {
// should be unreachable