Add review comments and replies

This commit is contained in:
Sebastian Martinez
2025-06-26 08:41:01 +02:00
parent b1bcfc7cd8
commit 33b8ecde59
2 changed files with 26 additions and 6 deletions
+6
View File
@@ -525,6 +525,12 @@
</div>
</CommentComponent>
</div>
{#if review.threads.length > 0}
{#each review.threads as thread}
<div class="connector"></div>
<Thread {baseUrl} {thread} rawPath={rawPath(revisionBase)} />
{/each}
{/if}
{/if}
{/each}
{/if}
+20 -6
View File
@@ -15,8 +15,12 @@
replies: Comment[];
}
interface ReviewWithThreads extends Review {
threads: Thread[];
}
interface TimelineReview {
inner: [string, Review];
inner: [string, ReviewWithThreads];
type: "review";
timestamp: number;
}
@@ -186,11 +190,21 @@
revisionDescription: rev.description,
},
[
...rev.reviews.map<TimelineReview>(review => ({
timestamp: review.timestamp,
type: "review",
inner: [review.author.id, review],
})),
...rev.reviews.map<TimelineReview>(review => {
const reviewThreads: Thread[] = review.comments
.filter(comment => !comment.replyTo)
.map(thread => ({
root: thread,
replies: review.comments
.filter(comment => comment.replyTo === thread.id)
.sort((a, b) => a.timestamp - b.timestamp),
}));
return {
timestamp: review.timestamp,
type: "review",
inner: [review.author.id, { ...review, threads: reviewThreads }],
};
}),
...patch.merges
.filter(merge => merge.revision === rev.id)
.map<TimelineMerge>(inner => ({