The best way to control Claude Code, Codex and more from any computer or phone
fix(web): keep review thread replies with their finding in pull request comments (#20894)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Marcus Hof committed
Oct 20, 2026 at 07:41 UTC
70a869d262c100969971800d3a704dbaea731535
8 files changed
+787
-122
apps/web/src/components/pullRequest/PullRequestDetailPanel.browser.test.tsx
+149
-28
@@ -92,7 +92,14 @@ vi.mock(import("~/state/pullRequests"), async (original) => {
92
vi.mock(import("~/state/query"), async (original) => ({
93
...(await original()),
94
useEnvironmentQuery: ((query: unknown) => ({
95
- data: query === "detail" ? currentDetail : query === queries.diff ? diff : null,
95
+ data:
96
+ query === "detail"
97
+ ? (activityDetail ?? currentDetail)
98
+ : query === "activity"
99
+ ? activityDetail
100
+ : query === queries.diff
101
+ ? diff
102
+ : null,
103
dataUpdatedAt: 0,
104
failure: null,
105
isPending: false,
@@ -111,33 +118,41 @@ vi.mock(import("~/state/usePullRequestStack"), async (original) => ({
118
refresh,
119
})) as never,
120
}));
114
-// The summary stand-in exposes its panel actions and nested scrolling.
115
-vi.mock(import("./PullRequestSummaryTab"), async (original) => ({
116
- ...(await original()),
117
- PullRequestSummaryTab: (({
118
- onFixFinding,
119
- scrollerRef,
120
- }: ComponentProps<typeof import("./PullRequestSummaryTab").PullRequestSummaryTab>) => (
121
- <div ref={scrollerRef} data-testid="summary-scroller" className="h-full overflow-y-auto">
122
- <button
123
- type="button"
124
- onClick={() =>
125
- onFixFinding?.({
126
- kind: "check",
127
- check: { name: "Unit tests", status: "failure", description: "Test failed", url: null },
128
- })
129
- }
130
- >
131
- Fix check
132
- </button>
133
- <div data-testid="nested-scroller" className="h-40 overflow-y-auto">
134
- <div className="h-[2000px]" />
135
- </div>
136
- <div className="h-[3000px]" />
137
- </div>
138
- )) as never,
139
-}));
140
-
121
+// Action and scroll tests use stand-ins; activity tests render the real Summary.
122
+vi.mock(import("./PullRequestSummaryTab"), async (original) => {
123
+ const actual = await original();
124
+ return {
125
+ ...actual,
126
+ PullRequestSummaryTab: ((props: ComponentProps<typeof actual.PullRequestSummaryTab>) => {
127
+ if (activityDetail !== null) return <actual.PullRequestSummaryTab {...props} />;
128
+ const { onFixFinding, scrollerRef } = props;
129
+ return (
130
+ <div ref={scrollerRef} data-testid="summary-scroller" className="h-full overflow-y-auto">
131
+ <button
132
+ type="button"
133
+ onClick={() =>
134
+ onFixFinding?.({
135
+ kind: "check",
136
+ check: {
137
+ name: "Unit tests",
138
+ status: "failure",
139
+ description: "Test failed",
140
+ url: null,
141
+ },
142
+ })
143
+ }
144
+ >
145
+ Fix check
146
+ </button>
147
+ <div data-testid="nested-scroller" className="h-40 overflow-y-auto">
148
+ <div className="h-[2000px]" />
149
+ </div>
150
+ <div className="h-[3000px]" />
151
+ </div>
152
+ );
153
+ }) as never,
154
+ };
155
+});
156
vi.mock(import("../ui/toast"), async (original) => {
157
const actual = await original();
158
return {
@@ -203,6 +218,7 @@ const detail: PullRequestDetailView = {
218
};
219
220
let currentDetail = detail;
221
+let activityDetail: PullRequestDetailView | null = null;
222
223
// Enough lines to exercise the panel's title folding with the real virtualized Code tab.
224
const diff = {
@@ -258,6 +274,7 @@ function render(props: Partial<ComponentProps<typeof PullRequestDetailPanel>> =
274
}
275
276
beforeEach(() => {
277
+ activityDetail = null;
278
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
279
currentDetail = detail;
280
useComposerDraftStore.setState({ draftsByThreadKey: {} });
@@ -698,3 +715,107 @@ it("shows the current checkout recovery detail on the first failure and on retry
715
second.detail,
716
]);
717
});
718
+
719
+it("keeps discussion counts and Timeline expansion in sync with activity refreshes", async () => {
720
+ activityDetail = {
721
+ ...detail,
722
+ provider: SourceControlProviderKind.make("gitlab"),
723
+ url: "https://gitlab.com/owner/repo/-/merge_requests/1",
724
+ comments: [],
725
+ commentCount: 0,
726
+ commentsTruncated: true,
727
+ reviewThreads: [
728
+ {
729
+ id: "discussion-1",
730
+ path: "src/index.ts",
731
+ line: 1,
732
+ side: "right",
733
+ isResolved: false,
734
+ isOutdated: false,
735
+ comments: [
736
+ {
737
+ id: "note-1",
738
+ author: detail.author,
739
+ body: "Discussion finding",
740
+ createdAt: "2026-09-01T00:01:00Z",
741
+ url: "https://gitlab.com/owner/repo/-/merge_requests/1#note_1",
742
+ },
743
+ {
744
+ id: "note-2",
745
+ author: detail.author,
746
+ body: "Discussion reply",
747
+ createdAt: "2026-09-01T00:02:00Z",
748
+ url: "https://gitlab.com/owner/repo/-/merge_requests/1#note_2",
749
+ },
750
+ ],
751
+ },
752
+ ],
753
+ };
754
+ await render({ reference: activityDetail });
755
+ await expect.element(page.getByText("Discussion finding", { exact: true })).toBeVisible();
756
+ await expect.element(page.getByText("Discussion reply", { exact: true })).toBeVisible();
757
+ expect
758
+ .soft(page.getByRole("button", { name: /^Comments \(/ }).element().textContent)
759
+ .toBe("Comments (2)");
760
+ const warning = page.getByText(/open it on the host to read the rest/).element().textContent;
761
+ expect.soft(warning).toMatch(/\b2\b/);
762
+ expect.soft(warning).not.toMatch(/most recent/i);
763
+
764
+ await tab("Timeline").click();
765
+ await expect.element(page.getByText("Discussion finding", { exact: true }).last()).toBeVisible();
766
+ await expect.element(page.getByText("Discussion reply", { exact: true }).last()).toBeVisible();
767
+ expect.soft(page.getByLabelText(/^[0-9]+ comments?$/).element().textContent).toBe("2");
768
+
769
+ const threadToggle = page.getByRole("button", { name: /^src\/index\.ts:1/ });
770
+ const expectThread = (expanded: boolean, status: string | null) => {
771
+ const toggle = threadToggle.element();
772
+ if (status) expect(toggle.textContent).toContain(status);
773
+ else expect(toggle.textContent).not.toMatch(/Resolved|Review dismissed/);
774
+ const visibleBody = (toggle.parentElement as HTMLElement).innerText;
775
+ expect({
776
+ expanded: toggle.getAttribute("aria-expanded"),
777
+ findingVisible: visibleBody.includes("Discussion finding"),
778
+ replyVisible: visibleBody.includes("Discussion reply"),
779
+ }).toEqual({
780
+ expanded: String(expanded),
781
+ findingVisible: expanded,
782
+ replyVisible: expanded,
783
+ });
784
+ };
785
+ const refreshActivity = async (isResolved: boolean, reviewState: string | null = null) => {
786
+ await tab("Code").click();
787
+ await expect
788
+ .element(page.getByRole("button", { name: "Expand all files", exact: true }))
789
+ .toBeVisible();
790
+ const current = activityDetail!;
791
+ activityDetail = {
792
+ ...current,
793
+ comments: current.reviewThreads.flatMap((thread) =>
794
+ thread.comments.map((comment) => ({
795
+ ...comment,
796
+ kind: "review-comment" as const,
797
+ path: thread.path,
798
+ reviewState,
799
+ })),
800
+ ),
801
+ reviewThreads: current.reviewThreads.map((thread) => ({ ...thread, isResolved })),
802
+ };
803
+ await tab("Timeline").click();
804
+ };
805
+
806
+ expectThread(true, null);
807
+ await refreshActivity(true);
808
+ expectThread(false, "Resolved");
809
+ await threadToggle.click();
810
+ expectThread(true, "Resolved");
811
+ await refreshActivity(true);
812
+ expectThread(true, "Resolved");
813
+ await threadToggle.click();
814
+ expectThread(false, "Resolved");
815
+ await refreshActivity(false);
816
+ expectThread(true, null);
817
+ await refreshActivity(false, "DISMISSED");
818
+ expectThread(false, "Review dismissed");
819
+ await refreshActivity(false);
820
+ expectThread(true, null);
821
+});
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+9
-1
@@ -531,7 +531,15 @@ function usePullRequestDetail(
531
author: activity?.author ?? coreDetail.author,
532
reviewers: activity?.reviewers ?? coreDetail.reviewers,
533
comments: activity?.comments ?? [],
534
- commentCount: activity?.commentCount ?? 0,
534
+ commentCount: Math.max(
535
+ activity?.commentCount ?? 0,
536
+ new Set([
537
+ ...(activity?.comments.map((comment) => comment.id) ?? []),
538
+ ...(activity?.reviewThreads.flatMap((thread) =>
539
+ thread.comments.map((comment) => comment.id),
540
+ ) ?? []),
541
+ ]).size,
542
+ ),
543
commentsTruncated: activity?.commentsTruncated ?? false,
544
reviewThreads: activity?.reviewThreads ?? [],
545
commits: activity?.commits ?? [],
apps/web/src/components/pullRequest/PullRequestMoreReplies.tsx
new
+28
@@ -0,0 +1,28 @@
1
+import type { PullRequestReplyAvailability } from "./pullRequestDetail.logic";
2
+
3
+export function PullRequestMoreReplies({
4
+ moreReplies,
5
+ hasMoreReplies,
6
+ url,
7
+}: PullRequestReplyAvailability) {
8
+ if (!hasMoreReplies) return null;
9
+ return (
10
+ <div className="flex flex-wrap items-baseline gap-2 py-1 text-xs text-muted-foreground">
11
+ <span>
12
+ {moreReplies > 0
13
+ ? `${moreReplies.toLocaleString()} more ${moreReplies === 1 ? "reply" : "replies"}`
14
+ : "More replies"}
15
+ </span>
16
+ {url ? (
17
+ <a
18
+ href={url}
19
+ target="_blank"
20
+ rel="noopener noreferrer"
21
+ className="hover:text-foreground hover:underline"
22
+ >
23
+ View on host
24
+ </a>
25
+ ) : null}
26
+ </div>
27
+ );
28
+}
apps/web/src/components/pullRequest/PullRequestSummaryTab.browser.test.tsx
+65
-1
@@ -1,5 +1,10 @@
1
import { SourceControlProviderKind } from "@t3tools/contracts";
2
-import { EnvironmentId, ProjectId, type PullRequestDetailView } from "@t3tools/contracts";
2
+import {
3
+ EnvironmentId,
4
+ ProjectId,
5
+ type PullRequestDetailView,
6
+ type PullRequestComment,
7
+} from "@t3tools/contracts";
8
import { act } from "react";
9
import { createRoot, type Root } from "react-dom/client";
10
import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
@@ -219,3 +224,62 @@ it("hides bot and resolved comments until the filter shows them, and remembers t
224
await userEvent.click(filterButton());
225
expect(filterItem("Bot comments").getAttribute("aria-checked")).toBe("true");
226
});
227
+
228
+it("reveals whole older conversations with honest partial reply counts and a host link", async () => {
229
+ const comment = (index: number): PullRequestComment => ({
230
+ id: `comment-${index}`,
231
+ kind: "issue-comment",
232
+ author: detail.author,
233
+ body: `Comment ${index}`,
234
+ createdAt: `2026-09-01T00:00:${String(index).padStart(2, "0")}Z`,
235
+ url: `${detail.url}#comment-${index}`,
236
+ path: null,
237
+ reviewState: null,
238
+ });
239
+ const finding = { ...comment(0), kind: "review-comment" as const, body: "Review finding" };
240
+ const reply = { ...comment(12), kind: "review-comment" as const, body: "Loaded reply" };
241
+ const thread = {
242
+ id: "partial-thread",
243
+ path: "src/index.ts",
244
+ line: 1,
245
+ side: "right" as const,
246
+ isResolved: true,
247
+ isOutdated: false,
248
+ comments: [finding, reply],
249
+ nextCommentsCursor: "next-page",
250
+ };
251
+ const value: PullRequestDetailView = {
252
+ ...detail,
253
+ comments: [finding, ...Array.from({ length: 10 }, (_, index) => comment(index + 1)), reply],
254
+ commentCount: 15,
255
+ reviewThreads: [{ ...thread, commentCount: 5 }],
256
+ };
257
+ await render(value);
258
+ await toggleFilter("Resolved or dismissed");
259
+ await userEvent.keyboard("{Escape}");
260
+ const older = [...container.querySelectorAll("button")].find((button) =>
261
+ button.textContent?.startsWith("Show 1 older"),
262
+ )!;
263
+ expect(older).toBeDefined();
264
+ expect.soft(older.textContent).toMatch(/1 older conversation.*1 hidden/);
265
+ expect(commentTexts()).not.toContain(reply.body);
266
+ await userEvent.click(older);
267
+ const resolved = [...container.querySelectorAll("button")].find(
268
+ (button) => button.textContent === "Resolved",
269
+ )!;
270
+ expect(resolved.getAttribute("aria-expanded")).toBe("false");
271
+ expect(commentTexts()).not.toContain(reply.body);
272
+ expect.soft(visibleText()).toContain("4 replies");
273
+ await userEvent.click(resolved);
274
+ expect(commentTexts().slice(-2)).toEqual([finding.body, reply.body]);
275
+ expect.soft(visibleText()).toContain("3 more replies");
276
+ const hostLink = [...container.querySelectorAll("a")].find(
277
+ (link) =>
278
+ link.href === finding.url && /host/i.test(link.textContent ?? "") && link.checkVisibility(),
279
+ );
280
+ expect.soft(hostLink, "visible link to the unloaded replies on the host").toBeDefined();
281
+
282
+ await render({ ...value, reviewThreads: [thread] });
283
+ expect.soft(visibleText()).toMatch(/more replies/i);
284
+ expect(visibleText()).not.toContain("3 more replies");
285
+});
apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx
+111
-73
@@ -53,11 +53,17 @@ import { PullRequestLabelPicker } from "./PullRequestLabelPicker";
53
import { PullRequestReviewerPicker } from "./PullRequestReviewerPicker";
54
import { PullRequestActivityUnavailableState } from "./PullRequestActivityUnavailableState";
55
import {
56
+ filterPullRequestConversationItems,
57
+ isPullRequestCommentFinished,
58
latestPullRequestReviewOutcomes,
59
orderPullRequestComments,
60
+ pagePullRequestConversationItems,
61
+ pullRequestConversationItemComments,
62
+ pullRequestConversationItems,
63
pullRequestFindingKey,
64
pullRequestReviewOutcome,
65
visibleBody,
66
+ type PullRequestConversationItem,
67
type PullRequestFinding,
68
} from "./pullRequestDetail.logic";
69
import {
@@ -66,6 +72,7 @@ import {
72
} from "./pullRequestEditing.logic";
73
import { PullRequestMarkdown } from "./PullRequestMarkdown";
74
import { PullRequestCommentBody } from "./PullRequestCommentBody";
75
+import { PullRequestMoreReplies } from "./PullRequestMoreReplies";
76
import { PullRequestMarkdownEditor } from "./PullRequestMarkdownEditor";
77
import { PullRequestReactionBar } from "./PullRequestReactions";
78
import { PullRequestConversationGhost } from "./PullRequestGhosts";
@@ -203,6 +210,9 @@ function CollapsedComment({
210
reactionBar,
211
detail,
212
thread,
213
+ replyCount = 0,
214
+ replies = null,
215
+ moreReplies = null,
216
}: {
217
comment: PullRequestComment;
218
editing: CommentEditing;
@@ -211,6 +221,9 @@ function CollapsedComment({
221
reactionBar: ReactNode;
222
detail: PullRequestDetailView;
223
thread: PullRequestReviewThread | undefined;
224
+ replyCount?: number;
225
+ replies?: ReactNode;
226
+ moreReplies?: ReactNode;
227
}) {
228
const [open, setOpen] = useState(false);
229
const statusTriggerRef = useRef<HTMLButtonElement>(null);
@@ -220,6 +233,11 @@ function CollapsedComment({
233
<div className="p-3">
234
<div className="flex flex-wrap items-baseline gap-2">
235
<CommentIdentity comment={comment} detail={detail} />
236
+ {replyCount > 0 ? (
237
+ <span className="shrink-0 py-1 text-xs text-muted-foreground">
238
+ {replyCount} {replyCount === 1 ? "reply" : "replies"}
239
+ </span>
240
+ ) : null}
241
<CollapsibleTrigger
242
ref={statusTriggerRef}
243
className="flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground"
@@ -255,9 +273,11 @@ function CollapsedComment({
273
{body === null && !editing.canEdit(comment) ? null : (
274
<CommentBody className="mt-2" comment={comment} editing={editing} />
275
)}
276
+ {replies ? <div className="mt-3">{replies}</div> : null}
277
</div>
278
) : null}
279
</CollapsiblePanel>
280
+ {moreReplies ? <div className="px-3 pb-3">{moreReplies}</div> : null}
281
</article>
282
</Collapsible>
283
);
@@ -385,44 +405,40 @@ export function PullRequestSummaryTab({
405
onRefreshChecks?: () => void;
406
}) {
407
const [shown, setShown] = useState({ url: detail.url, count: COMMENT_PAGE });
388
- const shownComments = shown.url === detail.url ? shown.count : COMMENT_PAGE;
408
+ const shownConversations = shown.url === detail.url ? shown.count : COMMENT_PAGE;
409
const [commentFilter, setCommentFilter] = useLocalStorage(
410
COMMENT_FILTER_STORAGE_KEY,
411
DEFAULT_COMMENT_FILTER,
412
CommentFilterSchema,
413
);
394
- const threadByCommentId = new Map(
395
- detail.reviewThreads.flatMap((thread) =>
396
- thread.comments.map((comment) => [comment.id, thread] as const),
397
- ),
398
- );
399
-
400
- const isFinished = (comment: PullRequestComment) =>
401
- threadByCommentId.get(comment.id)?.isResolved === true ||
402
- pullRequestReviewOutcome(comment.reviewState) === "dismissed";
403
- const isBot = (comment: PullRequestComment) =>
404
- comment.author?.isBot === true || comment.author?.login.endsWith("[bot]") === true;
405
- const filteredComments = detail.comments.filter(
406
- (comment) =>
407
- (commentFilter.bots || !isBot(comment)) && (commentFilter.resolved || !isFinished(comment)),
414
+ const items = pullRequestConversationItems(detail.comments, detail.reviewThreads);
415
+ const filteredItems = filterPullRequestConversationItems(items, commentFilter);
416
+ const commentCount = items.reduce(
417
+ (count, item) => count + pullRequestConversationItemComments(item).length,
418
+ 0,
419
);
409
- const filteredOutCount = detail.comments.length - filteredComments.length;
410
- const recentComments = filteredComments.slice(
411
- Math.max(0, filteredComments.length - shownComments),
420
+ const filteredOutCount =
421
+ commentCount -
422
+ filteredItems.reduce(
423
+ (count, item) => count + pullRequestConversationItemComments(item).length,
424
+ 0,
425
+ );
426
+ const { shown: recentItems, hidden: hiddenConversationCount } = pagePullRequestConversationItems(
427
+ filteredItems,
428
+ shownConversations,
429
);
413
- const hiddenCommentCount = filteredComments.length - recentComments.length;
430
const [commentOrder, setCommentOrder] = useState<"newest" | "oldest">("newest");
415
- const visibleComments = orderPullRequestComments(recentComments, commentOrder);
431
+ const visibleItems = orderPullRequestComments(recentItems, commentOrder);
432
const showOldestCommentsButton =
417
- hiddenCommentCount > 0 ? (
433
+ hiddenConversationCount > 0 ? (
434
<Button
435
size="sm"
436
variant="outline"
437
className="w-full"
422
- onClick={() => setShown({ url: detail.url, count: shownComments + COMMENT_PAGE })}
438
+ onClick={() => setShown({ url: detail.url, count: shownConversations + COMMENT_PAGE })}
439
>
424
- Show {Math.min(hiddenCommentCount, COMMENT_PAGE)} older comment
425
- {hiddenCommentCount === 1 ? "" : "s"} ({hiddenCommentCount} hidden)
440
+ Show {Math.min(hiddenConversationCount, COMMENT_PAGE)} older conversation
441
+ {hiddenConversationCount === 1 ? "" : "s"} ({hiddenConversationCount} hidden)
442
</Button>
443
) : null;
444
// Read from the whole conversation, not the window shown below it: a verdict older than the
@@ -526,53 +542,35 @@ export function PullRequestSummaryTab({
542
},
543
};
544
529
- const renderComment = (comment: PullRequestComment) => {
530
- const thread = threadByCommentId.get(comment.id);
545
+ const reactionBarFor = (comment: PullRequestComment) => (
546
+ <PullRequestReactionBar
547
+ className="ml-auto justify-end"
548
+ reactions={comment.reactions ?? []}
549
+ canReact={detail.capabilities.reactions === true}
550
+ subjectId={comment.id}
551
+ environmentId={environmentId}
552
+ reference={reference}
553
+ onRefresh={onRefresh}
554
+ />
555
+ );
556
+
557
+ const renderCommentCard = (
558
+ comment: PullRequestComment,
559
+ thread: PullRequestReviewThread | undefined,
560
+ { reply = false }: { reply?: boolean } = {},
561
+ ) => {
562
const body = visibleBody(comment.body);
532
- if (isFinished(comment)) {
533
- return (
534
- <CollapsedComment
535
- key={`${detail.url}:${comment.id}`}
536
- comment={comment}
537
- editing={commentEditing}
538
- detail={detail}
539
- thread={thread}
540
- label={thread?.isResolved ? "Resolved" : "Review dismissed"}
541
- body={body}
542
- reactionBar={
543
- <PullRequestReactionBar
544
- className="ml-auto justify-end"
545
- reactions={comment.reactions ?? []}
546
- canReact={detail.capabilities.reactions === true}
547
- subjectId={comment.id}
548
- environmentId={environmentId}
549
- reference={reference}
550
- onRefresh={onRefresh}
551
- />
552
- }
553
- />
554
- );
555
- }
563
const outcome = pullRequestReviewOutcome(comment.reviewState);
564
const finding: PullRequestFinding | null =
558
- (comment.kind !== "review" && comment.kind !== "review-comment") || outcome === "approved"
565
+ reply ||
566
+ (comment.kind !== "review" && comment.kind !== "review-comment") ||
567
+ outcome === "approved"
568
? null
569
: thread === undefined
570
? body === null
571
? null
572
: { kind: "comment", comment }
573
: { kind: "thread", thread };
565
- const reactionBar = (
566
- <PullRequestReactionBar
567
- reactions={comment.reactions ?? []}
568
- canReact={detail.capabilities.reactions === true}
569
- subjectId={comment.id}
570
- environmentId={environmentId}
571
- reference={reference}
572
- onRefresh={onRefresh}
573
- className="ml-auto justify-end"
574
- />
575
- );
574
return (
575
<article
576
key={`${detail.url}:${comment.id}`}
@@ -608,11 +606,13 @@ export function PullRequestSummaryTab({
606
</span>
607
</Button>
608
) : null}
611
- {reactionBar}
612
- </div>
613
- <div className="px-3">
614
- <CommentLocation comment={comment} thread={thread} />
609
+ {reactionBarFor(comment)}
610
</div>
611
+ {reply ? null : (
612
+ <div className="px-3">
613
+ <CommentLocation comment={comment} thread={thread} />
614
+ </div>
615
+ )}
616
{body === null && !commentEditing.canEdit(comment) ? null : (
617
<CommentBody className="px-3 py-3" comment={comment} editing={commentEditing} />
618
)}
@@ -620,6 +620,44 @@ export function PullRequestSummaryTab({
620
);
621
};
622
623
+ const renderItem = (item: PullRequestConversationItem) => {
624
+ const comment = item.kind === "comment" ? item.comment : item.root;
625
+ const thread = item.kind === "thread" ? item.thread : undefined;
626
+ const replies =
627
+ item.kind === "thread" && item.replies.length > 0 ? (
628
+ <div className="ml-4 space-y-2 border-l-2 border-border/60 pl-3">
629
+ {item.replies.map((reply) => renderCommentCard(reply, undefined, { reply: true }))}
630
+ </div>
631
+ ) : null;
632
+ const moreReplies =
633
+ item.kind === "thread" && item.hasMoreReplies ? <PullRequestMoreReplies {...item} /> : null;
634
+ if (isPullRequestCommentFinished(comment, thread)) {
635
+ return (
636
+ <CollapsedComment
637
+ key={`${detail.url}:${item.kind}:${item.id}`}
638
+ comment={comment}
639
+ editing={commentEditing}
640
+ detail={detail}
641
+ thread={thread}
642
+ label={thread?.isResolved ? "Resolved" : "Review dismissed"}
643
+ body={visibleBody(comment.body)}
644
+ replyCount={item.kind === "thread" ? item.replies.length + item.moreReplies : 0}
645
+ replies={replies}
646
+ moreReplies={moreReplies}
647
+ reactionBar={reactionBarFor(comment)}
648
+ />
649
+ );
650
+ }
651
+ if (item.kind === "comment") return renderCommentCard(comment, undefined);
652
+ return (
653
+ <div key={`${detail.url}:thread:${item.id}`} className="space-y-2">
654
+ {renderCommentCard(comment, thread)}
655
+ {replies}
656
+ {moreReplies}
657
+ </div>
658
+ );
659
+ };
660
+
661
return (
662
<div ref={scrollerRef} className="h-full overflow-y-auto" data-pull-request-summary-scroll>
663
<section className="px-4 pt-2.5 pb-1">
@@ -869,13 +907,13 @@ export function PullRequestSummaryTab({
907
<>
908
{detail.commentsTruncated ? (
909
<p className="mb-2 rounded-md border border-warning/30 bg-warning-surface px-2 py-1.5 text-xs">
872
- This conversation is longer than this page reads in one go. The most recent{" "}
873
- {detail.comments.length} are here; open it on the host to read the rest.
910
+ This conversation is only partially loaded. {commentCount} comment
911
+ {commentCount === 1 ? " is" : "s are"} loaded; open it on the host to read the rest.
912
</p>
913
) : null}
876
- {detail.comments.length === 0 ? (
914
+ {items.length === 0 ? (
915
<p className="py-2 text-xs text-muted-foreground">No comments yet.</p>
878
- ) : filteredComments.length === 0 ? (
916
+ ) : filteredItems.length === 0 ? (
917
<p className="py-2 text-xs text-muted-foreground">
918
{filteredOutCount === 1
919
? "The only comment is hidden by the filter."
@@ -884,16 +922,16 @@ export function PullRequestSummaryTab({
922
) : (
923
<div className="space-y-3">
924
{commentOrder === "oldest" ? showOldestCommentsButton : null}
887
- {visibleComments.map(renderComment)}
925
+ {visibleItems.map(renderItem)}
926
{commentOrder === "newest" ? showOldestCommentsButton : null}
889
- {shownComments > COMMENT_PAGE ? (
927
+ {shownConversations > COMMENT_PAGE ? (
928
<Button
929
size="sm"
930
variant="ghost"
931
className="w-full"
932
onClick={() => setShown({ url: detail.url, count: COMMENT_PAGE })}
933
>
896
- Show only {COMMENT_PAGE} recent comments
934
+ Show only {COMMENT_PAGE} recent conversations
935
</Button>
936
) : null}
937
</div>
apps/web/src/components/pullRequest/PullRequestTimelineTab.tsx
+119
-2
@@ -9,6 +9,7 @@ import type {
9
} from "@t3tools/contracts";
10
import {
11
ChevronDownIcon,
12
+ CircleCheckIcon,
13
ExternalLinkIcon,
14
FileCode2Icon,
15
GitCommitHorizontalIcon,
@@ -34,9 +35,11 @@ import {
35
pullRequestReviewOutcome,
36
type PullRequestReviewOutcome,
37
type PullRequestTimelineEvent,
38
+ type PullRequestTimelineThread,
39
} from "./pullRequestDetail.logic";
40
import { canEditPullRequestComment } from "./pullRequestEditing.logic";
41
import { PullRequestMarkdown } from "./PullRequestMarkdown";
42
+import { PullRequestMoreReplies } from "./PullRequestMoreReplies";
43
import { PullRequestMarkdownEditor } from "./PullRequestMarkdownEditor";
44
import { PullRequestReactionBar } from "./PullRequestReactions";
45
import {
@@ -178,12 +181,14 @@ function ConversationCard({
181
cwd,
182
onOpen,
183
reactions,
184
+ showPath = true,
185
}: {
186
event: PullRequestTimelineEvent;
187
editable: PullRequestComment | null;
188
cwd: string;
189
onOpen: (url: string) => void;
190
reactions: ReactionSurface;
191
+ showPath?: boolean;
192
}) {
193
const [editing, setEditing] = useState(false);
194
const [saving, setSaving] = useState(false);
@@ -223,7 +228,7 @@ function ConversationCard({
228
<span>
229
<RelativeTime timestamp={event.at} />
230
</span>
226
- {event.path ? (
231
+ {showPath && event.path ? (
232
<span className="inline-flex min-w-0 items-center gap-1">
233
<FileCode2Icon aria-hidden className="size-3 shrink-0" />
234
<span className="truncate">{event.path}</span>
@@ -365,6 +370,103 @@ function ConversationGroup({
370
);
371
}
372
373
+function ReviewThreadEvent({
374
+ event,
375
+ thread,
376
+ editable,
377
+ cwd,
378
+ onOpen,
379
+ reactions,
380
+}: {
381
+ event: PullRequestTimelineEvent;
382
+ thread: PullRequestTimelineThread;
383
+ editable: ReadonlyMap<string, PullRequestComment>;
384
+ cwd: string;
385
+ onOpen: (url: string) => void;
386
+ reactions: ReactionSurface;
387
+}) {
388
+ const dismissed = pullRequestReviewOutcome(event.reviewState) === "dismissed";
389
+ const [expanded, setExpanded] = useState(!thread.isResolved && !dismissed);
390
+ const replyCount = thread.replies.length + thread.moreReplies;
391
+
392
+ return (
393
+ <div className="group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]">
394
+ <ActorTimelineMarker
395
+ actors={event.actor ? [event.actor] : []}
396
+ className="top-6"
397
+ fallback={<MessageSquareIcon className="size-3.5" />}
398
+ muted={!expanded}
399
+ />
400
+ <button
401
+ type="button"
402
+ className="flex w-full min-w-0 items-center gap-2 px-2 py-2 text-left text-2xs text-muted-foreground hover:text-foreground"
403
+ aria-expanded={expanded}
404
+ onClick={() => setExpanded((current) => !current)}
405
+ >
406
+ <FileCode2Icon aria-hidden className="size-3 shrink-0" />
407
+ <span className="min-w-0 truncate font-mono">
408
+ {thread.line === null ? thread.path : `${thread.path}:${thread.line}`}
409
+ </span>
410
+ {thread.isResolved ? (
411
+ <span className="inline-flex shrink-0 items-center gap-1 font-medium text-success-foreground">
412
+ <CircleCheckIcon aria-hidden className="size-3" />
413
+ Resolved
414
+ </span>
415
+ ) : null}
416
+ {dismissed ? <span className="shrink-0 font-medium">Review dismissed</span> : null}
417
+ {thread.isOutdated ? <span className="shrink-0 font-medium">Outdated</span> : null}
418
+ {expanded ? null : (
419
+ <span className="shrink-0">
420
+ · {event.actor?.login ?? "ghost"}
421
+ {replyCount > 0 ? (
422
+ <>
423
+ {" "}
424
+ · {replyCount.toLocaleString()} {replyCount === 1 ? "reply" : "replies"}
425
+ </>
426
+ ) : null}
427
+ </span>
428
+ )}
429
+ <ChevronDownIcon
430
+ aria-hidden
431
+ className={cn("ml-auto size-3.5 shrink-0 transition-transform", expanded && "rotate-180")}
432
+ />
433
+ </button>
434
+ {expanded ? (
435
+ <>
436
+ <ConversationCard
437
+ event={event}
438
+ editable={editable.get(event.id) ?? null}
439
+ cwd={cwd}
440
+ onOpen={onOpen}
441
+ reactions={reactions}
442
+ showPath={false}
443
+ />
444
+ {thread.replies.length > 0 ? (
445
+ <div className="ml-2 space-y-1 border-l border-border/60 pl-3">
446
+ {thread.replies.map((reply) => (
447
+ <ConversationCard
448
+ key={reply.id}
449
+ event={reply}
450
+ editable={editable.get(reply.id) ?? null}
451
+ cwd={cwd}
452
+ onOpen={onOpen}
453
+ reactions={reactions}
454
+ showPath={false}
455
+ />
456
+ ))}
457
+ </div>
458
+ ) : null}
459
+ </>
460
+ ) : null}
461
+ {thread.hasMoreReplies ? (
462
+ <div className="px-2">
463
+ <PullRequestMoreReplies {...thread} />
464
+ </div>
465
+ ) : null}
466
+ </div>
467
+ );
468
+}
469
+
470
function CommitEvent({
471
event,
472
onOpen,
@@ -554,7 +656,9 @@ export function PullRequestTimelineTab({
656
onRefresh,
657
};
658
const editable = new Map(
557
- detail.comments
659
+ events
660
+ .flatMap((event) => [event, ...(event.thread?.replies ?? [])])
661
+ .flatMap((event) => (event.comment ? [event.comment] : []))
662
.filter((comment) => canEditPullRequestComment(detail, comment))
663
.map((comment) => [comment.id, comment] as const),
664
);
@@ -583,6 +687,19 @@ export function PullRequestTimelineTab({
687
);
688
}
689
const event = row.event;
690
+ if (event.thread !== undefined) {
691
+ return (
692
+ <ReviewThreadEvent
693
+ key={`${reactions.reference.projectId}#${reactions.reference.number}:thread:${event.id}:${event.thread.isResolved}:${pullRequestReviewOutcome(event.reviewState) === "dismissed"}`}
694
+ event={event}
695
+ thread={event.thread}
696
+ editable={editable}
697
+ cwd={detail.workspaceRoot}
698
+ onOpen={openOnHost}
699
+ reactions={reactions}
700
+ />
701
+ );
702
+ }
703
if (event.kind === "commit") {
704
return <CommitEvent key={event.id} event={event} onOpen={onOpenCommit} />;
705
}
apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts
+142
@@ -33,6 +33,10 @@ import {
33
canDeletePullRequestBranch,
34
buildFixFindingsHandoff,
35
groupPullRequestTimelineConversations,
36
+ filterPullRequestConversationItems,
37
+ pagePullRequestConversationItems,
38
+ pullRequestConversationItemComments,
39
+ pullRequestConversationItems,
40
handoffPrompt,
41
handoffReviewComments,
42
stripPullRequestHandoffReferences,
@@ -723,6 +727,144 @@ describe("pull request timeline", () => {
727
});
728
});
729
730
+describe("review thread conversations", () => {
731
+ const bot = { login: "review[bot]", name: null, avatarUrl: null, isBot: true };
732
+ const comment = (id: string, day: number): PullRequestComment => ({
733
+ ...TIMELINE_SOURCE.comments[0]!,
734
+ id,
735
+ kind: "review-comment",
736
+ body: `Current ${id}`,
737
+ createdAt: `2026-07-0${day}T12:00:00Z`,
738
+ url: `https://example.test/pull/1#${id}`,
739
+ path: "src/a.ts",
740
+ });
741
+ const finding = { ...comment("finding", 2), author: bot };
742
+ const reply = {
743
+ ...comment("reply", 4),
744
+ reactions: [
745
+ { content: "thumbs-up" as const, count: 2, actors: ["author"], viewerHasReacted: true },
746
+ ],
747
+ };
748
+ const lastReply = comment("last-reply", 6);
749
+ const loose = TIMELINE_SOURCE.comments[0]!;
750
+ const comments = [finding, loose, reply, lastReply];
751
+ const thread: PullRequestReviewThread = {
752
+ id: "thread",
753
+ path: "src/a.ts",
754
+ line: 7,
755
+ side: "right",
756
+ isResolved: false,
757
+ isOutdated: true,
758
+ comments: [lastReply, { ...finding, body: "Stale finding" }, reply],
759
+ };
760
+
761
+ it("keeps a timeline finding and its replies in one row at the finding time", () => {
762
+ const events = buildPullRequestTimeline({
763
+ ...TIMELINE_SOURCE,
764
+ comments,
765
+ reviewThreads: [thread],
766
+ });
767
+ expect(events.map((event) => event.id)).toEqual(["c1", "finding", "1baf7bdcafe", "created"]);
768
+ expect(events[1]).toMatchObject({
769
+ id: finding.id,
770
+ at: finding.createdAt,
771
+ body: finding.body,
772
+ url: finding.url,
773
+ thread: {
774
+ path: thread.path,
775
+ line: 7,
776
+ isOutdated: true,
777
+ replies: [
778
+ { id: reply.id, body: reply.body, url: reply.url, reactions: reply.reactions },
779
+ { id: lastReply.id, body: lastReply.body, url: lastReply.url },
780
+ ],
781
+ },
782
+ });
783
+ expect(groupPullRequestTimelineConversations(events).map((row) => row.kind)).toEqual([
784
+ "comments",
785
+ "event",
786
+ "event",
787
+ "event",
788
+ ]);
789
+ expect(events[0]).toEqual(buildPullRequestTimeline(TIMELINE_SOURCE)[0]);
790
+ });
791
+
792
+ it("orders and pages whole Summary conversations while retaining editable comment copies", () => {
793
+ const earlier = { ...loose, id: "earlier", createdAt: "2026-07-01T00:00:00Z" };
794
+ const items = pullRequestConversationItems([earlier, ...comments], [thread]);
795
+ expect(orderPullRequestComments(items, "oldest").map((item) => item.id)).toEqual([
796
+ "earlier",
797
+ "thread",
798
+ "c1",
799
+ ]);
800
+ expect(orderPullRequestComments(items, "newest").map((item) => item.id)).toEqual([
801
+ "c1",
802
+ "thread",
803
+ "earlier",
804
+ ]);
805
+ const page = pagePullRequestConversationItems(items, 2);
806
+ expect(page.hidden).toBe(1);
807
+ const grouped = page.shown[0]!;
808
+ expect(grouped.createdAt).toBe(finding.createdAt);
809
+ expect(pullRequestConversationItemComments(grouped)).toEqual([finding, reply, lastReply]);
810
+ expect(pullRequestConversationItemComments(grouped)[0]).toBe(finding);
811
+ expect(pullRequestConversationItemComments(grouped)[1]).toBe(reply);
812
+ expect(pagePullRequestConversationItems(items, 1)).toEqual({ shown: [items[2]], hidden: 2 });
813
+ expect(pullRequestConversationItemComments(items[2]!)).toEqual([loose]);
814
+ expect(pullRequestConversationItems(comments, []).map((item) => item.id)).toEqual(
815
+ comments.map((entry) => entry.id),
816
+ );
817
+ });
818
+
819
+ it("filters whole conversations when any member matches, including resolved and dismissed reviews", () => {
820
+ const botOnly = { ...comment("bot-only", 7), author: bot };
821
+ const dismissed = {
822
+ ...comment("dismissed", 8),
823
+ kind: "review" as const,
824
+ reviewState: "DISMISSED",
825
+ };
826
+ const items = pullRequestConversationItems(
827
+ [...comments, botOnly, dismissed],
828
+ [thread, { ...thread, id: "bot-thread", comments: [botOnly] }],
829
+ );
830
+ const kept = filterPullRequestConversationItems(items, { bots: false, resolved: false });
831
+ expect(kept.map((item) => item.id)).toEqual(["thread", "c1"]);
832
+ expect(pullRequestConversationItemComments(kept[0]!)).toEqual([finding, reply, lastReply]);
833
+ expect(filterPullRequestConversationItems(items, { bots: true, resolved: true })).toEqual(
834
+ items,
835
+ );
836
+ const resolved = pullRequestConversationItems(comments, [{ ...thread, isResolved: true }]);
837
+ expect(
838
+ filterPullRequestConversationItems(resolved, { bots: true, resolved: false }).map(
839
+ (item) => item.id,
840
+ ),
841
+ ).toEqual(["c1"]);
842
+ expect(filterPullRequestConversationItems(resolved, { bots: false, resolved: true })).toEqual(
843
+ resolved,
844
+ );
845
+ });
846
+
847
+ it("distinguishes unloaded replies from complete threads, even when the host only supplies a cursor", () => {
848
+ const timeline = (reviewThread: PullRequestReviewThread) =>
849
+ buildPullRequestTimeline({
850
+ ...TIMELINE_SOURCE,
851
+ comments,
852
+ reviewThreads: [reviewThread],
853
+ }).find((event) => event.id === finding.id)?.thread;
854
+ expect(timeline({ ...thread, commentCount: 5 })).toMatchObject({
855
+ moreReplies: 2,
856
+ hasMoreReplies: true,
857
+ url: finding.url,
858
+ });
859
+ expect(timeline({ ...thread, nextCommentsCursor: "next" })).toMatchObject({
860
+ moreReplies: 0,
861
+ hasMoreReplies: true,
862
+ url: finding.url,
863
+ });
864
+ expect(timeline(thread)).toMatchObject({ moreReplies: 0, hasMoreReplies: false });
865
+ });
866
+});
867
+
868
describe("fix findings handoff", () => {
869
const base = {
870
number: 42,
apps/web/src/components/pullRequest/pullRequestDetail.logic.ts
+164
-17
@@ -485,6 +485,21 @@ export interface PullRequestTimelineEvent {
485
readonly path: string | null;
486
readonly reviewState: string | null;
487
readonly reactions: ReadonlyArray<PullRequestReaction>;
488
+ readonly comment?: PullRequestComment;
489
+ readonly thread?: PullRequestTimelineThread;
490
+}
491
+
492
+export interface PullRequestReplyAvailability {
493
+ readonly moreReplies: number;
494
+ readonly hasMoreReplies: boolean;
495
+ readonly url: string | null;
496
+}
497
+
498
+export interface PullRequestTimelineThread
499
+ extends
500
+ Pick<PullRequestReviewThread, "path" | "line" | "isResolved" | "isOutdated">,
501
+ PullRequestReplyAvailability {
502
+ readonly replies: ReadonlyArray<PullRequestTimelineEvent>;
503
}
504
505
export type PullRequestTimelineRow =
@@ -498,6 +513,7 @@ export function groupPullRequestTimelineConversations(
513
for (const event of events) {
514
if (
515
(event.kind === "comment" || event.kind === "review") &&
516
+ event.thread === undefined &&
517
pullRequestReviewOutcome(event.reviewState) === null
518
) {
519
const last = rows.at(-1);
@@ -523,6 +539,136 @@ export function visibleBody(body: string): string | null {
539
return body.replace(/<!--[\s\S]*?-->/gu, "").trim().length === 0 ? null : body.trim();
540
}
541
542
+function commentTimelineEvent(comment: PullRequestComment): PullRequestTimelineEvent {
543
+ return {
544
+ comment,
545
+ id: comment.id,
546
+ at: comment.createdAt,
547
+ kind: comment.kind === "review" ? "review" : "comment",
548
+ title: comment.kind === "review" ? "reviewed" : "commented",
549
+ body: visibleBody(comment.body),
550
+ markdown: true,
551
+ url: comment.url,
552
+ actor: comment.author,
553
+ commitAuthors: [],
554
+ additions: null,
555
+ deletions: null,
556
+ path: comment.path,
557
+ reviewState: comment.reviewState,
558
+ reactions: comment.reactions ?? [],
559
+ };
560
+}
561
+
562
+export type PullRequestConversationItem =
563
+ | {
564
+ readonly kind: "comment";
565
+ readonly id: string;
566
+ readonly createdAt: string;
567
+ readonly comment: PullRequestComment;
568
+ }
569
+ | ({
570
+ readonly kind: "thread";
571
+ readonly id: string;
572
+ readonly createdAt: string;
573
+ readonly root: PullRequestComment;
574
+ readonly replies: ReadonlyArray<PullRequestComment>;
575
+ readonly thread: PullRequestReviewThread;
576
+ } & PullRequestReplyAvailability);
577
+
578
+export function pullRequestConversationItems(
579
+ comments: ReadonlyArray<PullRequestComment>,
580
+ reviewThreads: ReadonlyArray<PullRequestReviewThread>,
581
+): ReadonlyArray<PullRequestConversationItem> {
582
+ const byId = new Map(comments.map((comment) => [comment.id, comment]));
583
+ const claimed = new Set<string>();
584
+ const threads: PullRequestConversationItem[] = [];
585
+ for (const thread of reviewThreads) {
586
+ // Keep the conversation's objects for editing/reactions; some hosts only include a
587
+ // comment in the thread, so normalize that copy when the flat conversation lacks it.
588
+ const ordered = thread.comments
589
+ .map(
590
+ (comment): PullRequestComment =>
591
+ byId.get(comment.id) ?? {
592
+ ...comment,
593
+ kind: "review-comment",
594
+ path: thread.path,
595
+ reviewState: null,
596
+ },
597
+ )
598
+ .toSorted((left, right) => instant(left.createdAt) - instant(right.createdAt));
599
+ const [root, ...replies] = ordered;
600
+ if (root === undefined) continue;
601
+ for (const comment of ordered) claimed.add(comment.id);
602
+ const moreReplies = Math.max(0, (thread.commentCount ?? ordered.length) - ordered.length);
603
+ threads.push({
604
+ kind: "thread",
605
+ id: thread.id,
606
+ createdAt: root.createdAt,
607
+ root,
608
+ replies,
609
+ thread,
610
+ moreReplies,
611
+ hasMoreReplies: moreReplies > 0 || thread.nextCommentsCursor !== undefined,
612
+ url: ordered.find((comment) => comment.url !== null)?.url ?? null,
613
+ });
614
+ }
615
+ threads.sort((left, right) => instant(left.createdAt) - instant(right.createdAt));
616
+ const items: PullRequestConversationItem[] = [];
617
+ let next = 0;
618
+ // Preserve loose comments' existing order, inserting each thread at its finding's time.
619
+ for (const comment of comments) {
620
+ if (claimed.has(comment.id)) continue;
621
+ while (
622
+ next < threads.length &&
623
+ instant(threads[next]!.createdAt) < instant(comment.createdAt)
624
+ ) {
625
+ items.push(threads[next++]!);
626
+ }
627
+ items.push({ kind: "comment", id: comment.id, createdAt: comment.createdAt, comment });
628
+ }
629
+ items.push(...threads.slice(next));
630
+ return items;
631
+}
632
+
633
+export function pullRequestConversationItemComments(
634
+ item: PullRequestConversationItem,
635
+): ReadonlyArray<PullRequestComment> {
636
+ return item.kind === "comment" ? [item.comment] : [item.root, ...item.replies];
637
+}
638
+
639
+export function isPullRequestCommentFinished(
640
+ comment: PullRequestComment,
641
+ thread?: PullRequestReviewThread,
642
+): boolean {
643
+ return (
644
+ thread?.isResolved === true || pullRequestReviewOutcome(comment.reviewState) === "dismissed"
645
+ );
646
+}
647
+
648
+export function filterPullRequestConversationItems(
649
+ items: ReadonlyArray<PullRequestConversationItem>,
650
+ filter: { readonly bots: boolean; readonly resolved: boolean },
651
+): ReadonlyArray<PullRequestConversationItem> {
652
+ return items.filter((item) =>
653
+ // Matching any member keeps the finding beside a human reply to a bot.
654
+ pullRequestConversationItemComments(item).some(
655
+ (comment) =>
656
+ (filter.bots ||
657
+ !(comment.author?.isBot === true || comment.author?.login.endsWith("[bot]"))) &&
658
+ (filter.resolved ||
659
+ !isPullRequestCommentFinished(comment, item.kind === "thread" ? item.thread : undefined)),
660
+ ),
661
+ );
662
+}
663
+
664
+export function pagePullRequestConversationItems(
665
+ items: ReadonlyArray<PullRequestConversationItem>,
666
+ count: number,
667
+): { readonly shown: ReadonlyArray<PullRequestConversationItem>; readonly hidden: number } {
668
+ const shown = items.slice(Math.max(0, items.length - count));
669
+ return { shown, hidden: items.length - shown.length };
670
+}
671
+
672
/**
673
* Merged wins over closed: GitHub sets both timestamps on a merge, and reporting "closed" for a
674
* merged pull request would misstate what happened.
@@ -531,7 +677,8 @@ export function buildPullRequestTimeline(
677
detail: Pick<
678
PullRequestDetailView,
679
"createdAt" | "author" | "commits" | "comments" | "mergedAt" | "closedAt"
534
- >,
680
+ > &
681
+ Partial<Pick<PullRequestDetailView, "reviewThreads">>,
682
): ReadonlyArray<PullRequestTimelineEvent> {
683
return [
684
{
@@ -566,22 +713,22 @@ export function buildPullRequestTimeline(
713
reviewState: null,
714
reactions: [],
715
})),
569
- ...detail.comments.map((comment) => ({
570
- id: comment.id,
571
- at: comment.createdAt,
572
- kind: comment.kind === "review" ? ("review" as const) : ("comment" as const),
573
- title: comment.kind === "review" ? "reviewed" : "commented",
574
- body: visibleBody(comment.body),
575
- markdown: true,
576
- url: comment.url,
577
- actor: comment.author,
578
- commitAuthors: [],
579
- additions: null,
580
- deletions: null,
581
- path: comment.path,
582
- reviewState: comment.reviewState,
583
- reactions: comment.reactions ?? [],
584
- })),
716
+ ...pullRequestConversationItems(detail.comments, detail.reviewThreads ?? []).map((item) => {
717
+ if (item.kind === "comment") return commentTimelineEvent(item.comment);
718
+ return {
719
+ ...commentTimelineEvent(item.root),
720
+ thread: {
721
+ path: item.thread.path,
722
+ line: item.thread.line,
723
+ isResolved: item.thread.isResolved,
724
+ isOutdated: item.thread.isOutdated,
725
+ replies: item.replies.map(commentTimelineEvent),
726
+ moreReplies: item.moreReplies,
727
+ hasMoreReplies: item.hasMoreReplies,
728
+ url: item.url,
729
+ },
730
+ };
731
+ }),
732
...(detail.mergedAt
733
? [
734
{