From 45aeaeefd4a1fcfac396ef28f8030c2dcb2ae1ba Mon Sep 17 00:00:00 2001 From: trevor-signal <131492920+trevor-signal@users.noreply.github.com> Date: Wed, 6 Dec 2023 16:27:22 -0500 Subject: [PATCH] Guard against long message attachments rendering --- ts/state/selectors/message.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ts/state/selectors/message.ts b/ts/state/selectors/message.ts index 01a534c90c..6fc8858a2e 100644 --- a/ts/state/selectors/message.ts +++ b/ts/state/selectors/message.ts @@ -138,6 +138,7 @@ import type { CallHistorySelectorType } from './callHistory'; import { CallMode } from '../../types/Calling'; import { CallDirection } from '../../types/CallDisposition'; import { getCallIdFromEra } from '../../util/callDisposition'; +import { LONG_MESSAGE } from '../../types/MIME'; export { isIncoming, isOutgoing, isStory }; @@ -313,11 +314,15 @@ export const getAttachmentsForMessage = ({ }, ]; } - - return attachments - .filter(attachment => !attachment.error || canBeDownloaded(attachment)) - .map(attachment => getPropsForAttachment(attachment)) - .filter(isNotNil); + return ( + attachments + .filter(attachment => !attachment.error || canBeDownloaded(attachment)) + // Long message attachments are removed from message.attachments quickly, + // but in case they are still around, let's make sure not to show them + .filter(attachment => attachment.contentType !== LONG_MESSAGE) + .map(attachment => getPropsForAttachment(attachment)) + .filter(isNotNil) + ); }; export const processBodyRanges = (