From 1ffb44fc27e79a3009fec2495ee563913cffe24c Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 1 Mar 2025 21:44:51 +0200 Subject: [PATCH] web/timeline: fix message for unknown session errors --- web/src/ui/timeline/content/EncryptedBody.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/ui/timeline/content/EncryptedBody.tsx b/web/src/ui/timeline/content/EncryptedBody.tsx index 4906043..70e611d 100644 --- a/web/src/ui/timeline/content/EncryptedBody.tsx +++ b/web/src/ui/timeline/content/EncryptedBody.tsx @@ -17,9 +17,12 @@ import EventContentProps from "./props.ts" import LockIcon from "../../../icons/lock.svg?react" import LockClockIcon from "../../../icons/lock.svg?react" +const unknownSessionErrorPrefix = "failed to decrypt megolm event: no session with given ID found" + const EncryptedBody = ({ event }: EventContentProps) => { - if (event.decryption_error) { - return
Failed to decrypt: {event.decryption_error}
+ const decryptionError = event.last_edit?.decryption_error ?? event.decryption_error + if (decryptionError && !decryptionError.startsWith(unknownSessionErrorPrefix)) { + return
Failed to decrypt: {decryptionError}
} return
Waiting for message
}