From 5ce4692a7b09b343314fc7ed665587749bd44d78 Mon Sep 17 00:00:00 2001 From: Lotus CI Date: Sun, 18 Oct 2026 00:11:34 -0400 Subject: [PATCH] fix(consent): a retry that fails again reopens the terms prompt (#311) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closing the dialog via "I've accepted — retry" also deactivated its focus trap, whose onDeactivate is "Later": every close set the 10 s snooze, so a retry made before the terms were really accepted failed silently. Retry now closes without snoozing (and clears any earlier snooze). Fixes #311 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5 --- src/app/components/ConsentRequiredPrompt.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/components/ConsentRequiredPrompt.tsx b/src/app/components/ConsentRequiredPrompt.tsx index d683c81b1..8ba637fe9 100644 --- a/src/app/components/ConsentRequiredPrompt.tsx +++ b/src/app/components/ConsentRequiredPrompt.tsx @@ -44,6 +44,9 @@ export function ConsentRequiredPrompt() { const [opened, setOpened] = useState(false); const [blockedCount, setBlockedCount] = useState(0); const snoozedUntil = useRef(0); + // [Gitea #311] Closing via Retry also deactivates the focus trap; that must + // not snooze, or a retry that fails again (terms not accepted yet) is silent. + const closingForRetry = useRef(false); const blocked = useRef(new Map()); const modalStyle = useModalStyle(440); const server = mx.getDomain() ?? 'Your homeserver'; @@ -74,6 +77,8 @@ export function ConsentRequiredPrompt() { }, [consentUri]); const retry = useCallback(() => { + closingForRetry.current = true; + snoozedUntil.current = 0; setOpen(false); setOpened(false); const pending = Array.from(blocked.current.entries()); @@ -97,7 +102,13 @@ export function ConsentRequiredPrompt() { focusTrapOptions={{ initialFocus: '#consent-review', fallbackFocus: '#consent-later', - onDeactivate: later, + onDeactivate: () => { + if (closingForRetry.current) { + closingForRetry.current = false; + return; + } + later(); + }, clickOutsideDeactivates: true, escapeDeactivates: true, }}