|
1 | 1 | import { useAtomRefresh } from "@effect/atom-react"; |
2 | 2 | import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native"; |
| 3 | +import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients"; |
3 | 4 | import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"; |
4 | 5 | import type { PullRequestReviewVerdict } from "@t3tools/contracts"; |
5 | 6 | import { useCallback, useRef, useState } from "react"; |
@@ -84,12 +85,21 @@ export function PullRequestReviewSheet({ |
84 | 85 | const verdict = offered.find((option) => option.value === requestedVerdict) ?? offered[0]; |
85 | 86 | const reviewing = params.mode === "review"; |
86 | 87 | const canSubmitComments = !store.draft.comments.length || permissions.canInlineComment; |
| 88 | + // Forgejo requires a summary when requesting changes, even with inline comments. |
| 89 | + const summaryRequired = |
| 90 | + verdict !== undefined && result.data |
| 91 | + ? sourceControlClients.get(result.data.provider).reviewSummaryRequired(verdict.value) |
| 92 | + : false; |
87 | 93 | const canSubmit = |
88 | 94 | store.ready && |
89 | 95 | (!reviewing || (!stale && canSubmitComments)) && |
90 | 96 | (reviewing |
91 | 97 | ? verdict !== undefined && |
92 | | - (verdict.value === "approve" || body.trim().length > 0 || store.draft.comments.length > 0) |
| 98 | + (summaryRequired |
| 99 | + ? body.trim().length > 0 |
| 100 | + : verdict.value === "approve" || |
| 101 | + body.trim().length > 0 || |
| 102 | + store.draft.comments.length > 0) |
93 | 103 | : permissions.canComment && body.trim().length > 0); |
94 | 104 | const perform = () => |
95 | 105 | submission.submit(async () => { |
@@ -160,7 +170,13 @@ export function PullRequestReviewSheet({ |
160 | 170 | <TextInput |
161 | 171 | multiline |
162 | 172 | accessibilityLabel={reviewing ? "Review summary" : "Comment"} |
163 | | - placeholder={reviewing ? "Summarize your review…" : "Write a comment…"} |
| 173 | + placeholder={ |
| 174 | + reviewing |
| 175 | + ? summaryRequired |
| 176 | + ? "Summarize your review (required to request changes)" |
| 177 | + : "Summarize your review…" |
| 178 | + : "Write a comment…" |
| 179 | + } |
164 | 180 | placeholderTextColorClassName="accent-foreground-muted" |
165 | 181 | editable={store.ready && !submission.busy} |
166 | 182 | value={body} |
|
0 commit comments