diff --git a/ts/components/conversation/GIF.tsx b/ts/components/conversation/GIF.tsx index cbcf51f080..9269d26add 100644 --- a/ts/components/conversation/GIF.tsx +++ b/ts/components/conversation/GIF.tsx @@ -4,7 +4,6 @@ import React, { useRef, useState, useEffect } from 'react'; import classNames from 'classnames'; import { Blurhash } from 'react-blurhash'; -import formatFileSize from 'filesize'; import { LocalizerType, ThemeType } from '../../types/Util'; import { Spinner } from '../Spinner'; @@ -170,7 +169,7 @@ export const GIF: React.FC = props => { if (isNotDownloaded && attachment.fileSize) { fileSize = (
- {formatFileSize(attachment.fileSize || 0)} · GIF + {attachment.fileSize} · GIF
); } diff --git a/ts/components/conversation/Message.stories.tsx b/ts/components/conversation/Message.stories.tsx index 342837433a..0424bd5ec4 100644 --- a/ts/components/conversation/Message.stories.tsx +++ b/ts/components/conversation/Message.stories.tsx @@ -801,7 +801,7 @@ story.add('Not Downloaded GIF', () => { contentType: VIDEO_MP4, flags: SignalService.AttachmentPointer.Flags.GIF, fileName: 'cat-gif.mp4', - fileSize: 188610, + fileSize: '188.61 KB', blurHash: 'LDA,FDBnm+I=p{tkIUI;~UkpELV]', width: 400, height: 332, @@ -821,7 +821,7 @@ story.add('Pending GIF', () => { contentType: VIDEO_MP4, flags: SignalService.AttachmentPointer.Flags.GIF, fileName: 'cat-gif.mp4', - fileSize: 188610, + fileSize: '188.61 KB', blurHash: 'LDA,FDBnm+I=p{tkIUI;~UkpELV]', width: 400, height: 332, diff --git a/ts/state/selectors/message.ts b/ts/state/selectors/message.ts index 1656ecc20e..cb6a788d59 100644 --- a/ts/state/selectors/message.ts +++ b/ts/state/selectors/message.ts @@ -8,7 +8,6 @@ import { LastMessageStatus, MessageAttributesType, ShallowChallengeError, - WhatIsThis, } from '../../model-types.d'; import { TimelineItemType } from '../../components/conversation/TimelineItem'; @@ -940,7 +939,7 @@ export function getPropsForEmbeddedContact( } export function getPropsForAttachment( - attachment: WhatIsThis + attachment: AttachmentType ): AttachmentType | null { if (!attachment) { return null; @@ -950,10 +949,12 @@ export function getPropsForAttachment( return { ...attachment, - fileSize: size ? filesize(size) : null, + fileSize: size ? filesize(size) : undefined, isVoiceMessage: isVoiceMessage(attachment), pending, - url: path ? window.Signal.Migrations.getAbsoluteAttachmentPath(path) : null, + url: path + ? window.Signal.Migrations.getAbsoluteAttachmentPath(path) + : undefined, screenshot: screenshot ? { ...screenshot, @@ -961,7 +962,7 @@ export function getPropsForAttachment( screenshot.path ), } - : null, + : undefined, thumbnail: thumbnail ? { ...thumbnail, @@ -969,7 +970,7 @@ export function getPropsForAttachment( thumbnail.path ), } - : null, + : undefined, }; } diff --git a/ts/types/Attachment.ts b/ts/types/Attachment.ts index cd0a27d6b2..1faff2ff15 100644 --- a/ts/types/Attachment.ts +++ b/ts/types/Attachment.ts @@ -31,7 +31,7 @@ export type AttachmentType = { /** For messages not already on disk, this will be a data url */ url?: string; size?: number; - fileSize?: number; + fileSize?: string; pending?: boolean; width?: number; height?: number;