feat(e2ee): undecryptable placeholder says why and offers the fix (#159)
CI / Build & Quality Checks (push) Canceled after 0s
CI / Trigger Desktop Build (push) Canceled after 0s
CI / Secret scan (gitleaks) (push) Canceled after 0s
CI / Docker image build & smoke test (push) Canceled after 0s
CI / Playwright smoke (e2e) (push) Canceled after 0s

'Unable to decrypt message' now carries one sentence per matrix-js-sdk
DecryptionFailureCode (describeDecryptionFailure, unit-tested against every
code so no raw code can leak into the copy) and, where something fixes it,
one button: no key backup → 'Set up key backup'; backup exists but this
session can't open it / key withheld for an unverified session → 'Unlock key
backup' / 'Verify this session' (both open Settings → Devices via a new
settingsRequestAtom that SettingsTab consumes); backup working or unknown
session (rust-crypto re-requests keys itself) → 'Retry', which re-runs
decryptEventIfNeeded. Sender-side problems are plain text. The raw code sits
in the placeholder's tooltip for support.

Verified headless on a fresh session in the encrypted seed room: each event
shows 'Sent before you signed in here, and no key backup exists…' with
tooltip HISTORICAL_MESSAGE_NO_KEY_BACKUP; the button opens Settings → Devices.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-09-19 13:23:25 -04:00
co-authored by Claude Opus 5
parent 6f25035341
commit 0e2671891f
8 changed files with 214 additions and 10 deletions
+20 -3
View File
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { useAtom } from 'jotai';
import {
Badge,
Box,
@@ -23,7 +24,8 @@ import { useMatrixClient } from '../../../hooks/useMatrixClient';
import { getMxIdLocalPart, mxcUrlToHttp } from '../../../utils/matrix';
import { nameInitials } from '../../../utils/common';
import { useMediaAuthentication } from '../../../hooks/useMediaAuthentication';
import { Settings } from '../../../features/settings';
import { Settings, SettingsPages } from '../../../features/settings';
import { settingsRequestAtom } from '../../../state/settingsRequest';
import { useUserProfile } from '../../../hooks/useUserProfile';
import { Modal500 } from '../../../components/Modal500';
import { useSetting } from '../../../state/hooks/settings';
@@ -172,6 +174,21 @@ export function SettingsTab() {
const profile = useUserProfile(userId);
const [settingsOpen, setSettingsOpen] = useState(false);
// [Gitea #159] Programmatic "open settings at page X" requests.
const [settingsRequest, setSettingsRequest] = useAtom(settingsRequestAtom);
const [initialPage, setInitialPage] = useState<SettingsPages | undefined>();
useEffect(() => {
if (!settingsRequest) return;
const page = {
general: SettingsPages.GeneralPage,
account: SettingsPages.AccountPage,
notifications: SettingsPages.NotificationPage,
devices: SettingsPages.DevicesPage,
}[settingsRequest];
setInitialPage(page);
setSettingsOpen(true);
setSettingsRequest(null);
}, [settingsRequest, setSettingsRequest]);
const displayName = profile.displayName ?? getMxIdLocalPart(userId) ?? userId;
const avatarUrl = profile.avatarUrl
@@ -201,7 +218,7 @@ export function SettingsTab() {
<PresencePicker />
{settingsOpen && (
<Modal500 requestClose={() => setSettingsOpen(false)}>
<Settings requestClose={() => setSettingsOpen(false)} />
<Settings initialPage={initialPage} requestClose={() => setSettingsOpen(false)} />
</Modal500>
)}
</SidebarItem>