diff --git a/ts/components/conversation/TimelineMessage.tsx b/ts/components/conversation/TimelineMessage.tsx index d3b05c7826..96fcb9d9f1 100644 --- a/ts/components/conversation/TimelineMessage.tsx +++ b/ts/components/conversation/TimelineMessage.tsx @@ -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) { diff --git a/ts/state/selectors/message.ts b/ts/state/selectors/message.ts index b264c96907..c1830fc006 100644 --- a/ts/state/selectors/message.ts +++ b/ts/state/selectors/message.ts @@ -2068,15 +2068,19 @@ export function canDownload( message: MessageWithUIFieldsType, conversationSelector: GetConversationByIdType ): boolean { - if (isOutgoing(message)) { - return true; - } - const conversation = getConversation(message, conversationSelector); const isAccepted = Boolean( conversation && conversation.acceptedMessageRequest ); - if (!isAccepted) { + if (isIncoming(message) && !isAccepted) { + return false; + } + + if (message.sticker) { + return false; + } + + if (isTapToView(message)) { return false; } @@ -2086,7 +2090,7 @@ export function canDownload( return attachments.every(attachment => Boolean(attachment.path)); } - return true; + return false; } export function getLastChallengeError(