Allow stage and send of video, even if we can't get screenshot

This commit is contained in:
Scott Nonnenberg 2021-11-15 13:54:33 -08:00 committed by GitHub
parent 117cb074c7
commit a024ee4b96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 224 additions and 143 deletions

View file

@ -78,40 +78,46 @@ export type DownloadedAttachmentType = AttachmentType & {
export type BaseAttachmentDraftType = {
blurHash?: string;
contentType: MIME.MIMEType;
fileName: string;
path: string;
screenshotContentType?: string;
screenshotSize?: number;
size: number;
flags?: number;
};
// An ephemeral attachment type, used between user's request to add the attachment as
// a draft and final save on disk and in conversation.draftAttachments.
export type InMemoryAttachmentDraftType =
| ({
data?: Uint8Array;
data: Uint8Array;
pending: false;
screenshotData?: Uint8Array;
fileName?: string;
path?: string;
} & BaseAttachmentDraftType)
| {
contentType: MIME.MIMEType;
fileName: string;
path: string;
fileName?: string;
path?: string;
pending: true;
size: number;
};
// What's stored in conversation.draftAttachments
export type AttachmentDraftType =
| ({
url: string;
url?: string;
screenshotPath?: string;
pending: false;
// Old draft attachments may have a caption, though they are no longer editable
// because we removed the caption editor.
caption?: string;
fileName?: string;
path: string;
} & BaseAttachmentDraftType)
| {
contentType: MIME.MIMEType;
fileName: string;
path: string;
fileName?: string;
path?: string;
pending: true;
size: number;
};
@ -614,6 +620,10 @@ export function getUrl(attachment: AttachmentType): string | undefined {
return attachment.screenshot.url;
}
if (isVideoAttachment(attachment)) {
return undefined;
}
return attachment.url;
}