From 1bab28239a2f825fc37a635b7166cf31631e6cc4 Mon Sep 17 00:00:00 2001 From: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> Date: Fri, 17 Jan 2025 09:34:22 -0800 Subject: [PATCH] Fix undownloadable attachment check to require download error --- ts/components/conversation/Image.tsx | 48 ++++++++++++------------ ts/components/conversation/ImageGrid.tsx | 29 +++++++++----- ts/components/conversation/Message.tsx | 18 +++++++-- ts/types/Attachment.ts | 6 +++ 4 files changed, 64 insertions(+), 37 deletions(-) diff --git a/ts/components/conversation/Image.tsx b/ts/components/conversation/Image.tsx index 077e0fef45..6ec8e88126 100644 --- a/ts/components/conversation/Image.tsx +++ b/ts/components/conversation/Image.tsx @@ -14,8 +14,8 @@ import type { } from '../../types/Attachment'; import { defaultBlurHash, - isDownloadable, isIncremental, + isPermanentlyUndownloadable, isReadyToView, } from '../../types/Attachment'; import { ProgressCircle } from '../ProgressCircle'; @@ -191,10 +191,7 @@ export function Image({ ); const startDownloadButton = - startDownload && - !attachment.path && - !attachment.pending && - !isIncremental(attachment) ? ( + !attachment.path && !attachment.pending && !isIncremental(attachment) ? ( + ) : ( + startDownloadButton + ) + ) : null; + const spinner = isIncremental(attachment) || !cancelDownload ? undefined @@ -218,8 +234,6 @@ export function Image({ tabIndex, }); - const isMediaDownloadable = isDownloadable(attachment); - return (
{imageOrBlurHash} - {isMediaDownloadable ? ( - startDownloadButton - ) : ( - - )} + {startDownloadOrUnavailableButton} {spinner} {attachment.caption ? ( @@ -267,7 +269,7 @@ export function Image({ /> ) : null} {(attachment.path || isIncremental(attachment)) && - isMediaDownloadable && + !isUndownloadable && playIconOverlay ? (
@@ -290,9 +292,7 @@ export function Image({ style={curveStyles} /> ) : null} - {showVisualAttachment && - isReadyToView(attachment) && - isMediaDownloadable ? ( + {showVisualAttachment && isReadyToView(attachment) ? (