Draft attachments: Show image as generic attachment if too big

This commit is contained in:
Scott Nonnenberg 2021-11-19 13:19:42 -08:00 committed by GitHub
parent 555c6e6bfa
commit 7bb37dc63b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);