Skip to content

Commit b0f7331

Browse files
committed
fix(mobile): Forgejo change requests ask for the summary they require
1 parent 4ff8b07 commit b0f7331

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useAtomRefresh } from "@effect/atom-react";
22
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
3+
import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
34
import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
45
import type { PullRequestReviewVerdict } from "@t3tools/contracts";
56
import { useCallback, useRef, useState } from "react";
@@ -84,12 +85,21 @@ export function PullRequestReviewSheet({
8485
const verdict = offered.find((option) => option.value === requestedVerdict) ?? offered[0];
8586
const reviewing = params.mode === "review";
8687
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;
8793
const canSubmit =
8894
store.ready &&
8995
(!reviewing || (!stale && canSubmitComments)) &&
9096
(reviewing
9197
? 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)
93103
: permissions.canComment && body.trim().length > 0);
94104
const perform = () =>
95105
submission.submit(async () => {
@@ -160,7 +170,13 @@ export function PullRequestReviewSheet({
160170
<TextInput
161171
multiline
162172
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+
}
164180
placeholderTextColorClassName="accent-foreground-muted"
165181
editable={store.ready && !submission.busy}
166182
value={body}

0 commit comments

Comments
 (0)