From 7897a695e351b7e8ebaa0d8c693660291af18286 Mon Sep 17 00:00:00 2001 From: oliver <97427849+flamboh@users.noreply.github.com> Date: Wed, 14 Oct 2026 10:49:00 -0700 Subject: [PATCH] fix(web): review summary only says optional when it is (#18451) --- .../pull-requests/PullRequestReviewSheet.tsx | 2 +- .../pullRequest/PullRequestReviewForm.tsx | 75 ++++++++++--------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx b/apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx index a1495eb19f513adddab7b1ac6646c26f61b5845e..539775aa44d0b4887222935c713ad1ed53fcdc65 100644 --- a/apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx +++ b/apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx @@ -154,7 +154,7 @@ export function PullRequestReviewSheet({ /> } > - {reviewing && offered.length ? ( + {reviewing && offered.length > 1 ? ( ({ value: option.value, label: option.title }))} selected={verdict?.value ?? "comment"} diff --git a/apps/web/src/components/pullRequest/PullRequestReviewForm.tsx b/apps/web/src/components/pullRequest/PullRequestReviewForm.tsx index f4359d3dfbdd36f3a12b449e11440bbe45aabb0b..2449b7a7c9448ca0813b65e40a98b6c1b89c44d1 100644 --- a/apps/web/src/components/pullRequest/PullRequestReviewForm.tsx +++ b/apps/web/src/components/pullRequest/PullRequestReviewForm.tsx @@ -116,10 +116,17 @@ export function PullRequestReviewForm({ }; // Forgejo requires a summary when requesting changes, even with inline comments. - const canSubmit = (verdict: PullRequestReviewVerdict) => + const canSubmit = (verdict: PullRequestReviewVerdict, summary: string) => verdict === "request-changes" && requestChangesSummaryRequired - ? body.trim().length > 0 - : verdict === "approve" || body.trim().length > 0 || comments.length > 0; + ? summary.trim().length > 0 + : verdict === "approve" || summary.trim().length > 0 || comments.length > 0; + // The placeholder asks for exactly what the submit button is waiting on. + const placeholder = + selectedVerdict === undefined || canSubmit(selectedVerdict.value, "") + ? "Summarize your review (optional)" + : selectedVerdict.value === "request-changes" && requestChangesSummaryRequired + ? "Summarize your review (required to request changes)" + : "Summarize your review or add line comments"; return ( <> @@ -127,42 +134,42 @@ export function PullRequestReviewForm({ ref={textareaRef} rows={3} value={body} - placeholder={ - requestChangesSummaryRequired && verdicts.includes("request-changes") - ? "Summarize your review (required to request changes)" - : "Summarize your review (optional)" - } + placeholder={placeholder} aria-label="Review summary" onChange={(event) => setSummary(reviewKey, event.target.value)} /> -
- +
+ {offered.length > 1 ? ( + + ) : null}