Fix forwarding messages with undownloadable attachments

This commit is contained in:
ayumi-signal 2025-02-12 06:52:21 -08:00 committed by GitHub
parent a02a111358
commit 7fb898441b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,7 +34,10 @@ import {
MESSAGE_EXPIRED, MESSAGE_EXPIRED,
actions as conversationsActions, actions as conversationsActions,
} from './conversations'; } from './conversations';
import { isDownloaded } from '../../types/Attachment'; import {
isDownloaded,
isPermanentlyUndownloadable,
} from '../../types/Attachment';
import type { ButtonVariant } from '../../components/Button'; import type { ButtonVariant } from '../../components/Button';
import type { MessageRequestState } from '../../components/conversation/MessageRequestActionsConfirmation'; import type { MessageRequestState } from '../../components/conversation/MessageRequestActionsConfirmation';
import type { MessageForwardDraft } from '../../types/ForwardDraft'; import type { MessageForwardDraft } from '../../types/ForwardDraft';
@ -667,7 +670,13 @@ function toggleForwardMessagesModal(
} }
const { attachments = [] } = message.attributes; const { attachments = [] } = message.attributes;
if (!attachments.every(isDownloaded)) { if (
!attachments.every(
attachment =>
isDownloaded(attachment) ||
isPermanentlyUndownloadable(attachment)
)
) {
dispatch( dispatch(
conversationsActions.kickOffAttachmentDownload({ messageId }) conversationsActions.kickOffAttachmentDownload({ messageId })
); );
@ -679,7 +688,12 @@ function toggleForwardMessagesModal(
const messageProps = messagePropsSelector(message.attributes); const messageProps = messagePropsSelector(message.attributes);
const messageDraft = toMessageForwardDraft( const messageDraft = toMessageForwardDraft(
messageProps, {
...messageProps,
attachments: attachments.filter(
attachment => !isPermanentlyUndownloadable(attachment)
),
},
conversationSelector conversationSelector
); );