Use streams to download attachments directly to disk
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
parent
2da49456c6
commit
99b2bc304e
48 changed files with 2297 additions and 356 deletions
|
@ -51,7 +51,7 @@ import {
|
|||
suspendLinkPreviews,
|
||||
} from '../../services/LinkPreview';
|
||||
import {
|
||||
getMaximumAttachmentSizeInKb,
|
||||
getMaximumOutgoingAttachmentSizeInKb,
|
||||
getRenderDetailsForLimit,
|
||||
KIBIBYTE,
|
||||
} from '../../types/AttachmentSize';
|
||||
|
@ -1167,7 +1167,7 @@ function preProcessAttachment(
|
|||
|
||||
// Putting this after everything else because the other checks are more
|
||||
// important to show to the user.
|
||||
const limitKb = getMaximumAttachmentSizeInKb(getRemoteConfigValue);
|
||||
const limitKb = getMaximumOutgoingAttachmentSizeInKb(getRemoteConfigValue);
|
||||
if (file.size / KIBIBYTE > limitKb) {
|
||||
return {
|
||||
toastType: ToastType.FileSize,
|
||||
|
|
|
@ -676,6 +676,9 @@ export const getPropsForMessage = (
|
|||
message: MessageWithUIFieldsType,
|
||||
options: GetPropsForMessageOptions
|
||||
): Omit<PropsForMessage, 'renderingContext' | 'menu' | 'contextMenu'> => {
|
||||
const attachmentDroppedDueToSize = message.attachments?.some(
|
||||
item => item.wasTooBig
|
||||
);
|
||||
const attachments = getAttachmentsForMessage(message);
|
||||
const bodyRanges = processBodyRanges(message, options);
|
||||
const author = getAuthorForMessage(message, options);
|
||||
|
@ -734,6 +737,7 @@ export const getPropsForMessage = (
|
|||
|
||||
return {
|
||||
attachments,
|
||||
attachmentDroppedDueToSize,
|
||||
author,
|
||||
bodyRanges,
|
||||
previews,
|
||||
|
|
|
@ -8,7 +8,7 @@ import type { LocalizerType } from '../../types/Util';
|
|||
import type { StateType } from '../reducer';
|
||||
import { SmartStoryCreator } from './StoryCreator';
|
||||
import { StoriesTab } from '../../components/StoriesTab';
|
||||
import { getMaximumAttachmentSizeInKb } from '../../types/AttachmentSize';
|
||||
import { getMaximumOutgoingAttachmentSizeInKb } from '../../types/AttachmentSize';
|
||||
import type { ConfigKeyType } from '../../RemoteConfig';
|
||||
import { getMe } from '../selectors/conversations';
|
||||
import { getIntl, getTheme } from '../selectors/user';
|
||||
|
@ -74,7 +74,7 @@ export function SmartStoriesTab(): JSX.Element | null {
|
|||
const otherTabsUnreadStats = useSelector(getOtherTabsUnreadStats);
|
||||
|
||||
const remoteConfig = useSelector(getRemoteConfig);
|
||||
const maxAttachmentSizeInKb = getMaximumAttachmentSizeInKb(
|
||||
const maxAttachmentSizeInKb = getMaximumOutgoingAttachmentSizeInKb(
|
||||
(name: ConfigKeyType) => {
|
||||
const value = remoteConfig[name]?.value;
|
||||
return value ? String(value) : undefined;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue