From 7bb37dc63b930156a586c69706d157c8e7777461 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 19 Nov 2021 13:19:42 -0800 Subject: [PATCH] Draft attachments: Show image as generic attachment if too big --- ts/components/conversation/AttachmentList.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ts/components/conversation/AttachmentList.tsx b/ts/components/conversation/AttachmentList.tsx index f8144ec748c..dc790615deb 100644 --- a/ts/components/conversation/AttachmentList.tsx +++ b/ts/components/conversation/AttachmentList.tsx @@ -10,6 +10,7 @@ import type { LocalizerType } from '../../types/Util'; import type { AttachmentDraftType } from '../../types/Attachment'; import { areAllAttachmentsVisual, + canDisplayImage, isImageAttachment, isVideoAttachment, } from '../../types/Attachment'; @@ -74,7 +75,11 @@ export const AttachmentList = ({ const isVideo = isVideoAttachment(attachment); const closeAttachment = () => onCloseAttachment(attachment); - if (isImage || isVideo || attachment.pending) { + if ( + (isImage && canDisplayImage([attachment])) || + isVideo || + attachment.pending + ) { const isDownloaded = !attachment.pending; const imageUrl = url || (isVideo ? BLANK_VIDEO_THUMBNAIL : undefined);