Fix Boken Image & Sticker (#1455)
* fix image without info rendered as broken * fix enc msg appear as decrypting after deletion
This commit is contained in:
@@ -1034,13 +1034,10 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
const content = mEvent.getContent<IImageContent>();
|
||||
const imgInfo = content?.info;
|
||||
const mxcUrl = content.file?.url ?? content.url;
|
||||
if (!imgInfo || typeof imgInfo.mimetype !== 'string' || typeof mxcUrl !== 'string') {
|
||||
if (mxcUrl) {
|
||||
return fileRenderer(mEventId, mEvent);
|
||||
}
|
||||
if (typeof mxcUrl !== 'string') {
|
||||
return null;
|
||||
}
|
||||
const height = scaleYDimension(imgInfo.w || 400, 400, imgInfo.h || 400);
|
||||
const height = scaleYDimension(imgInfo?.w || 400, 400, imgInfo?.h || 400);
|
||||
|
||||
return (
|
||||
<Attachment>
|
||||
@@ -1052,7 +1049,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
<ImageContent
|
||||
body={content.body || 'Image'}
|
||||
info={imgInfo}
|
||||
mimeType={imgInfo.mimetype}
|
||||
mimeType={imgInfo?.mimetype}
|
||||
url={mxcUrl}
|
||||
encInfo={content.file}
|
||||
autoPlay={mediaAutoLoad}
|
||||
@@ -1309,6 +1306,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
>
|
||||
<EncryptedContent mEvent={mEvent}>
|
||||
{() => {
|
||||
if (mEvent.isRedacted()) return <MessageDeletedContent />;
|
||||
if (mEvent.getType() === MessageEvent.Sticker)
|
||||
return <StickerContent mEvent={mEvent} autoPlay={mediaAutoLoad} />;
|
||||
if (mEvent.getType() === MessageEvent.RoomMessage)
|
||||
|
||||
Reference in New Issue
Block a user