From 319b1502c634ce9ef2d8dd23d2ac7d9d0fa2e893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Mon, 28 Oct 2024 12:06:24 +0100 Subject: [PATCH] Fix issue sorting and timestamps Issues should be sorted by creation time and we should show the creation time as the issue timestamp. Otherwise edits will reorder the comment thread. --- src/components/Thread.svelte | 2 +- src/views/repo/Issue.svelte | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/Thread.svelte b/src/components/Thread.svelte index 966d9c73d..69c596273 100644 --- a/src/components/Thread.svelte +++ b/src/components/Thread.svelte @@ -115,7 +115,7 @@ author={reply.author} caption="replied" reactions={reply.reactions} - timestamp={reply.edits.slice(-1)[0].timestamp} + timestamp={reply.edits[0].timestamp} body={reply.edits.slice(-1)[0].body} editComment={editComment && canEditComment(reply.author.did) && diff --git a/src/views/repo/Issue.svelte b/src/views/repo/Issue.svelte index 76bf73996..ae512e18c 100644 --- a/src/views/repo/Issue.svelte +++ b/src/views/repo/Issue.svelte @@ -69,10 +69,7 @@ root: thread, replies: issue.discussion .filter(comment => comment.replyTo === thread.id) - .sort( - (a, b) => - a.edits.slice(-1)[0].timestamp - b.edits.slice(-1)[0].timestamp, - ), + .sort((a, b) => a.edits[0].timestamp - b.edits[0].timestamp), }; }, []);