mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-14 19:20:28 +03:00
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:
parent
c980fddfa1
commit
b92b281050
4 changed files with 50 additions and 43 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue