Only show download button if message has attachments to download

This commit is contained in:
Scott Nonnenberg 2024-10-29 08:46:33 +10:00 committed by GitHub
parent 86026bd66a
commit 12a9ecfd35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 16 deletions

View file

@ -109,7 +109,6 @@ export function TimelineMessage(props: Props): JSX.Element {
i18n,
id,
isTargeted,
isSticker,
isTapToView,
kickOffAttachmentDownload,
payment,
@ -259,15 +258,7 @@ export function TimelineMessage(props: Props): JSX.Element {
const shouldShowAdditional =
doesMessageBodyOverflow(text || '') || !isWindowWidthNotNarrow;
const hasPendingAttachments =
attachments?.length && attachments.some(attachment => attachment.pending);
// If any of the conditions is not given -> undefined is returned
// --> download menu icon is not rendered
const handleDownload =
canDownload && !isSticker && !isTapToView && !hasPendingAttachments
? openGenericAttachment
: undefined;
const handleDownload = canDownload ? openGenericAttachment : undefined;
const handleReplyToMessage = useCallback(() => {
if (!canReply) {