From 7fb898441b303a34fa3e2d77d9383998e4396e5d Mon Sep 17 00:00:00 2001 From: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> Date: Wed, 12 Feb 2025 06:52:21 -0800 Subject: [PATCH] Fix forwarding messages with undownloadable attachments --- ts/state/ducks/globalModals.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ts/state/ducks/globalModals.ts b/ts/state/ducks/globalModals.ts index 3677bef72f..4e0bca2f61 100644 --- a/ts/state/ducks/globalModals.ts +++ b/ts/state/ducks/globalModals.ts @@ -34,7 +34,10 @@ import { MESSAGE_EXPIRED, actions as conversationsActions, } from './conversations'; -import { isDownloaded } from '../../types/Attachment'; +import { + isDownloaded, + isPermanentlyUndownloadable, +} from '../../types/Attachment'; import type { ButtonVariant } from '../../components/Button'; import type { MessageRequestState } from '../../components/conversation/MessageRequestActionsConfirmation'; import type { MessageForwardDraft } from '../../types/ForwardDraft'; @@ -667,7 +670,13 @@ function toggleForwardMessagesModal( } const { attachments = [] } = message.attributes; - if (!attachments.every(isDownloaded)) { + if ( + !attachments.every( + attachment => + isDownloaded(attachment) || + isPermanentlyUndownloadable(attachment) + ) + ) { dispatch( conversationsActions.kickOffAttachmentDownload({ messageId }) ); @@ -679,7 +688,12 @@ function toggleForwardMessagesModal( const messageProps = messagePropsSelector(message.attributes); const messageDraft = toMessageForwardDraft( - messageProps, + { + ...messageProps, + attachments: attachments.filter( + attachment => !isPermanentlyUndownloadable(attachment) + ), + }, conversationSelector );