Skip to content

Commit

Permalink
Ensure non-visual attachments can be manually downloaded
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Nonnenberg <scott@signal.org>
  • Loading branch information
automated-signal and scottnonnenberg-signal committed Aug 31, 2022
1 parent 89a7cab commit 87998f1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ts/components/conversation/Message.tsx
Expand Up @@ -974,7 +974,10 @@ export class Message extends React.PureComponent<Props, State> {

if (
isImage(attachments) ||
(isVideo(attachments) && hasVideoScreenshot(attachments))
(isVideo(attachments) &&
(!isDownloaded(attachments[0]) ||
!attachments?.[0].pending ||
hasVideoScreenshot(attachments)))
) {
const bottomOverlay = !isSticker && !collapseMetadata;
// We only want users to tab into this if there's more than one
Expand Down Expand Up @@ -1081,7 +1084,16 @@ export class Message extends React.PureComponent<Props, State> {
)}
// There's only ever one of these, so we don't want users to tab into it
tabIndex={-1}
onClick={this.openGenericAttachment}
onClick={() => {
if (!isDownloaded(firstAttachment)) {
kickOffAttachmentDownload({
attachment: firstAttachment,
messageId: id,
});
} else {
this.openGenericAttachment();
}
}}
>
{pending ? (
<div className="module-message__generic-attachment__spinner-container">
Expand Down Expand Up @@ -2735,7 +2747,6 @@ export class Message extends React.PureComponent<Props, State> {
attachments &&
attachments.length > 0 &&
!isAttachmentPending &&
(isImage(attachments) || isVideo(attachments)) &&
!isDownloaded(attachments[0])
) {
event.preventDefault();
Expand Down

0 comments on commit 87998f1

Please sign in to comment.