From b74de3f6beaf25c44f983903a940c260136c493c Mon Sep 17 00:00:00 2001 From: William Grant Date: Fri, 24 May 2024 16:44:25 +1000 Subject: [PATCH] fix: quote icons were not appearing if media failed to create a preview --- .../message/message-content/Quote.tsx | 3 +- .../quote/QuoteIconContainer.tsx | 56 +++++++++---------- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/ts/components/conversation/message/message-content/Quote.tsx b/ts/components/conversation/message/message-content/Quote.tsx index 0075ce10e..017480f20 100644 --- a/ts/components/conversation/message/message-content/Quote.tsx +++ b/ts/components/conversation/message/message-content/Quote.tsx @@ -218,7 +218,8 @@ export const QuoteIconContainer = ( if (MIME.isAudio(contentType)) { return ; } - return null; + + return ; }; export const QuoteText = ( diff --git a/ts/components/conversation/message/message-content/quote/QuoteIconContainer.tsx b/ts/components/conversation/message/message-content/quote/QuoteIconContainer.tsx index 0f1855b03..ff53da182 100644 --- a/ts/components/conversation/message/message-content/quote/QuoteIconContainer.tsx +++ b/ts/components/conversation/message/message-content/quote/QuoteIconContainer.tsx @@ -94,44 +94,38 @@ export const QuoteIconContainer = ( } const { contentType, thumbnail } = attachment; - const isGenericFile = - !GoogleChrome.isVideoTypeSupported(contentType) && - !GoogleChrome.isImageTypeSupported(contentType) && - !MIME.isAudio(contentType); + const objectUrl = getObjectUrl(thumbnail); - if (isGenericFile) { - return ; + if (GoogleChrome.isVideoTypeSupported(contentType)) { + return objectUrl && !imageBroken ? ( + + ) : ( + + ); } - const objectUrl = getObjectUrl(thumbnail); - if (objectUrl) { - if (GoogleChrome.isVideoTypeSupported(contentType)) { - return ( - - ); - } - - if (GoogleChrome.isImageTypeSupported(contentType)) { - return ( - - ); - } + if (GoogleChrome.isImageTypeSupported(contentType)) { + return objectUrl && !imageBroken ? ( + + ) : ( + + ); } if (MIME.isAudio(contentType)) { return ; } - return null; + return ; };