From e94c9c92da922b062a06bb656500491431783fc9 Mon Sep 17 00:00:00 2001 From: OFF0 Date: Sun, 22 Jan 2023 15:26:10 +0100 Subject: [PATCH] feed: sort replies by created at replies were not sorted correctly, reason for this was that an array of dom elements was sorted, but instead it should sort the notes. regression introduced in: - 2e40a273c4caa5bc14c328c8e40840a82458d724 --- src/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 65e8611..045c9b6 100644 --- a/src/main.js +++ b/src/main.js @@ -463,7 +463,7 @@ function createTextNote(evt, relay) { // const content = isLongContent ? evt.content.slice(0, 280) : evt.content; const hasReactions = reactionMap[evt.id]?.length > 0; const didReact = hasReactions && !!reactionMap[evt.id].find(reaction => reaction.pubkey === pubkey); - const replyFeed = replies[0] ? replies.map(e => replyDomMap[e.id] = createTextNote(e, relay)) : []; + const replyFeed = replies[0] ? replies.sort(sortByCreatedAt).map(e => replyDomMap[e.id] = createTextNote(e, relay)) : []; const [content, {firstLink}] = parseTextContent(evt.content); const body = elem('div', {className: 'mbox-body'}, [ elem('header', { @@ -503,7 +503,7 @@ function createTextNote(evt, relay) { } return renderArticle([ elem('div', {className: 'mbox-img'}, [img]), body, - replies[0] ? elem('div', {className: 'mobx-replies'}, replyFeed.sort(sortByCreatedAt).reverse()) : '', + replies[0] ? elem('div', {className: 'mobx-replies'}, replyFeed.reverse()) : '', ], {data: {id: evt.id, pubkey: evt.pubkey, relay}}); }