1
0
Fork 0
forked from Mirrors/gomuks

web/timeline: fix message for unknown session errors

This commit is contained in:
Tulir Asokan 2025-03-01 21:44:51 +02:00
parent 83ea1c12ad
commit 1ffb44fc27

View file

@ -17,9 +17,12 @@ import EventContentProps from "./props.ts"
import LockIcon from "../../../icons/lock.svg?react" import LockIcon from "../../../icons/lock.svg?react"
import LockClockIcon 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) => { const EncryptedBody = ({ event }: EventContentProps) => {
if (event.decryption_error) { const decryptionError = event.last_edit?.decryption_error ?? event.decryption_error
return <div className="decryption-error-body"><LockIcon/> Failed to decrypt: {event.decryption_error}</div> if (decryptionError && !decryptionError.startsWith(unknownSessionErrorPrefix)) {
return <div className="decryption-error-body"><LockIcon/> Failed to decrypt: {decryptionError}</div>
} }
return <div className="decryption-pending-body"><LockClockIcon/> Waiting for message</div> return <div className="decryption-pending-body"><LockClockIcon/> Waiting for message</div>
} }