fix: quote icons were not appearing if media failed to create a preview

pull/3083/head
William Grant 1 year ago
parent 48fe7b4faa
commit b74de3f6be

@ -218,7 +218,8 @@ export const QuoteIconContainer = (
if (MIME.isAudio(contentType)) { if (MIME.isAudio(contentType)) {
return <QuoteIcon icon="microphone" />; return <QuoteIcon icon="microphone" />;
} }
return null;
return <QuoteIcon icon="file" />;
}; };
export const QuoteText = ( export const QuoteText = (

@ -94,19 +94,10 @@ export const QuoteIconContainer = (
} }
const { contentType, thumbnail } = attachment; const { contentType, thumbnail } = attachment;
const isGenericFile =
!GoogleChrome.isVideoTypeSupported(contentType) &&
!GoogleChrome.isImageTypeSupported(contentType) &&
!MIME.isAudio(contentType);
if (isGenericFile) {
return <QuoteIcon icon="file" />;
}
const objectUrl = getObjectUrl(thumbnail); const objectUrl = getObjectUrl(thumbnail);
if (objectUrl) {
if (GoogleChrome.isVideoTypeSupported(contentType)) { if (GoogleChrome.isVideoTypeSupported(contentType)) {
return ( return objectUrl && !imageBroken ? (
<QuoteImage <QuoteImage
url={objectUrl} url={objectUrl}
contentType={MIME.IMAGE_JPEG} contentType={MIME.IMAGE_JPEG}
@ -114,24 +105,27 @@ export const QuoteIconContainer = (
imageBroken={imageBroken} imageBroken={imageBroken}
handleImageErrorBound={noop} handleImageErrorBound={noop}
/> />
) : (
<QuoteIcon icon="movie" />
); );
} }
if (GoogleChrome.isImageTypeSupported(contentType)) { if (GoogleChrome.isImageTypeSupported(contentType)) {
return ( return objectUrl && !imageBroken ? (
<QuoteImage <QuoteImage
url={objectUrl} url={objectUrl}
contentType={contentType} contentType={contentType}
imageBroken={imageBroken} imageBroken={imageBroken}
handleImageErrorBound={handleImageErrorBound} handleImageErrorBound={handleImageErrorBound}
/> />
) : (
<QuoteIcon icon="image" />
); );
} }
}
if (MIME.isAudio(contentType)) { if (MIME.isAudio(contentType)) {
return <QuoteIcon icon="microphone" />; return <QuoteIcon icon="microphone" />;
} }
return null; return <QuoteIcon icon="file" />;
}; };

Loading…
Cancel
Save