Export long message attachments

This commit is contained in:
trevor-signal 2024-09-23 15:24:41 -04:00 committed by GitHub
parent a9406a7914
commit 511fc9c1a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 423 additions and 82 deletions

View file

@ -125,7 +125,12 @@ export function EditHistoryMessagesModal({
isEditedMessage
isSpoilerExpanded={revealedSpoilersById[currentMessageId] || {}}
key={currentMessage.timestamp}
kickOffAttachmentDownload={kickOffAttachmentDownload}
kickOffAttachmentDownload={({ attachment }) =>
kickOffAttachmentDownload({
attachment,
messageId: currentMessage.id,
})
}
messageExpanded={(messageId, displayLimit) => {
const update = {
...displayLimitById,
@ -188,7 +193,12 @@ export function EditHistoryMessagesModal({
getPreferredBadge={getPreferredBadge}
i18n={i18n}
isSpoilerExpanded={revealedSpoilersById[syntheticId] || {}}
kickOffAttachmentDownload={kickOffAttachmentDownload}
kickOffAttachmentDownload={({ attachment }) =>
kickOffAttachmentDownload({
attachment,
messageId: messageAttributes.id,
})
}
messageExpanded={(messageId, displayLimit) => {
const update = {
...displayLimitById,

View file

@ -650,15 +650,10 @@ export function LeftPane({
dialogs.push({ key: 'banner', dialog: maybeBanner });
}
// We'll show the backup media download progress banner if the download is currently or
// was ongoing at some point during the lifecycle of this component
const isMediaBackupDownloadIncomplete =
backupMediaDownloadProgress?.totalBytes > 0 &&
backupMediaDownloadProgress.downloadedBytes <
backupMediaDownloadProgress.totalBytes;
const hasMediaBeenQueuedForBackup =
backupMediaDownloadProgress?.totalBytes > 0;
if (
isMediaBackupDownloadIncomplete &&
hasMediaBeenQueuedForBackup &&
!backupMediaDownloadProgress.downloadBannerDismissed
) {
dialogs.push({

View file

@ -1966,6 +1966,9 @@ export class Message extends React.PureComponent<Props, State> {
if (!textAttachment) {
return;
}
if (isDownloaded(textAttachment)) {
return;
}
kickOffAttachmentDownload({
attachment: textAttachment,
messageId: id,

View file

@ -5,7 +5,7 @@ import type { KeyboardEvent } from 'react';
import React from 'react';
import type { AttachmentType } from '../../types/Attachment';
import { canBeDownloaded } from '../../types/Attachment';
import { canBeDownloaded, isDownloaded } from '../../types/Attachment';
import { getSizeClass } from '../emoji/lib';
import type { ShowConversationType } from '../../state/ducks/conversations';
@ -35,7 +35,7 @@ export type Props = {
text: string;
textAttachment?: Pick<
AttachmentType,
'pending' | 'digest' | 'key' | 'wasTooBig'
'pending' | 'digest' | 'key' | 'wasTooBig' | 'path'
>;
};
@ -97,6 +97,7 @@ export function MessageBody({
} else if (
textAttachment &&
canBeDownloaded(textAttachment) &&
!isDownloaded(textAttachment) &&
kickOffBodyDownload
) {
endNotification = (