fix: list a signed message's attachments once in the reader #58

This commit is contained in:
Linus Rath
2026-10-31 17:19:34 +01:00
parent be98acdc8b
commit 7a06ab03c0
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -76,8 +76,10 @@ export function MessageContent({
? secure.result.body ?? (secure.result.status.encrypted ? { html: null, text: '' } : null)
: null;
const bodyOverride = secureBody ?? unwrap.override;
// Only an encrypted message hides its attachments from the server; a
// signed one has them listed already.
const extracted = React.useMemo(
() => (secure.result?.attachments.length ? [...secure.result.attachments, ...unwrap.extracted] : unwrap.extracted),
() => (secure.result?.status.encrypted && secure.result.attachments.length ? [...secure.result.attachments, ...unwrap.extracted] : unwrap.extracted),
[secure.result, unwrap.extracted],
);
const calendarBannerShown = calendarBannerShownFor(email, calendarParsing);
@@ -31,5 +31,7 @@ describe('reader wiring', () => {
expect(reader).toMatch(/const secure = useSecureMessage\(email, jmapAccountId\);/);
expect(reader).toMatch(/bodyOverride=\{bodyOverride\}/);
expect(reader).toMatch(/<SecureMessageBanner status=/);
// A signed message's attachments are already listed by the server.
expect(reader).toMatch(/secure\.result\?\.status\.encrypted && secure\.result\.attachments\.length/);
});
});