Being able to reply to any comment from bot (#8621)
* Allow replying to any comment in a thread, not just the root Reply state now tracks a comment id instead of a group id, and reply composers/handlers are threaded through each comment row (root and replies alike) so any comment can receive an inline reply rather than only the thread root. * Fix reply cancellation clearing the wrong comment's reply box When multiple comment threads had reply boxes open, cancelling one reply cleared replyingCommentId unconditionally, closing whichever box was open instead of the one actually cancelled. onCancelReply now threads through the specific commentId so cancellation only clears state if it matches the currently open reply.
This commit is contained in:
@@ -1980,7 +1980,7 @@ function PRCommentGroupView({
|
||||
presentation: PRCommentPresentationClasses
|
||||
onResolve?: (threadId: string, resolve: boolean) => boolean | Promise<boolean>
|
||||
onStartReply?: (commentId: number) => void
|
||||
onCancelReply?: () => void
|
||||
onCancelReply?: (commentId: number) => void
|
||||
onReply?: (comment: PRComment, body: string) => Promise<RightPanelCommentSubmitResult>
|
||||
onEditComment?: (comment: PRComment, body: string) => Promise<boolean>
|
||||
onDeleteComment?: (comment: PRComment) => void | Promise<void>
|
||||
@@ -2001,7 +2001,7 @@ function PRCommentGroupView({
|
||||
autoFocus
|
||||
disabled={replyDisabled}
|
||||
disabledReason={replyDisabledReason}
|
||||
onCancel={onCancelReply}
|
||||
onCancel={() => onCancelReply?.(comment.id)}
|
||||
onSubmit={(body) => onReply(comment, body)}
|
||||
/>
|
||||
</div>
|
||||
@@ -2113,7 +2113,7 @@ function ResolvedCommentGroupsSection({
|
||||
presentation: PRCommentPresentationClasses
|
||||
onResolve?: (threadId: string, resolve: boolean) => boolean | Promise<boolean>
|
||||
onStartReply?: (commentId: number) => void
|
||||
onCancelReply?: () => void
|
||||
onCancelReply?: (commentId: number) => void
|
||||
onReply?: (comment: PRComment, body: string) => Promise<RightPanelCommentSubmitResult>
|
||||
onEditComment?: (comment: PRComment, body: string) => Promise<boolean>
|
||||
onDeleteComment?: (comment: PRComment) => void | Promise<void>
|
||||
@@ -2351,7 +2351,9 @@ export function PRCommentsList({
|
||||
presentation={presentation}
|
||||
onResolve={onResolve}
|
||||
onStartReply={setReplyingCommentId}
|
||||
onCancelReply={() => setReplyingCommentId(null)}
|
||||
onCancelReply={(commentId) =>
|
||||
setReplyingCommentId((current) => (current === commentId ? null : current))
|
||||
}
|
||||
onReply={onReply}
|
||||
onEditComment={onEditComment}
|
||||
onDeleteComment={onDeleteComment}
|
||||
@@ -2679,7 +2681,9 @@ export function PRCommentsList({
|
||||
presentation={presentation}
|
||||
onResolve={onResolve}
|
||||
onStartReply={setReplyingCommentId}
|
||||
onCancelReply={() => setReplyingCommentId(null)}
|
||||
onCancelReply={(commentId) =>
|
||||
setReplyingCommentId((current) => (current === commentId ? null : current))
|
||||
}
|
||||
onReply={onReply}
|
||||
onEditComment={onEditComment}
|
||||
onDeleteComment={onDeleteComment}
|
||||
|
||||
Reference in New Issue
Block a user