make sure screenshot of video attachment is saved locally

pull/2137/head
audric 3 years ago
parent 9f0ae00317
commit cea2c2460a

@ -874,7 +874,6 @@ class CompositionBoxInner extends React.Component<Props, State> {
} else {
// scale them down
const files = await Promise.all(stagedAttachments.map(AttachmentUtil.getFileAndStoreLocally));
attachments = _.compact(files);
}

@ -1636,7 +1636,6 @@ const trotthledAllConversationsDispatch = _.throttle(() => {
if (updatesToDispatch.size === 0) {
return;
}
console.warn('updatesToDispatch.size ', updatesToDispatch.size);
window.inboxStore?.dispatch(conversationsChanged([...updatesToDispatch.values()]));
updatesToDispatch.clear();

@ -108,13 +108,13 @@ export function canDisplayImage(attachments?: Array<AttachmentType>) {
const { height, width } =
attachments && attachments[0] ? attachments[0] : { height: 0, width: 0 };
return (
return Boolean(
height &&
height > 0 &&
height <= ATTACHMENT_DEFAULT_MAX_SIDE &&
width &&
width > 0 &&
width <= ATTACHMENT_DEFAULT_MAX_SIDE
height > 0 &&
height <= ATTACHMENT_DEFAULT_MAX_SIDE &&
width &&
width > 0 &&
width <= ATTACHMENT_DEFAULT_MAX_SIDE
);
}
@ -164,7 +164,6 @@ export function isVideoAttachment(attachment?: AttachmentType): boolean {
export function hasVideoScreenshot(attachments?: Array<AttachmentType>): boolean {
const firstAttachment = attachments ? attachments[0] : null;
return Boolean(firstAttachment?.screenshot?.url);
}

@ -134,8 +134,6 @@ export const loadQuoteData = async (quote: any) => {
if (!quote) {
return null;
}
console.warn('loadQuoteData', quote);
if (!quote.attachments?.length || isEmpty(quote.attachments[0])) {
return quote;
}

@ -271,6 +271,7 @@ export const captureDimensionsAndScreenshot = async (
const { width, height } = await getImageDimensions({
objectUrl: screenshotObjectUrl,
});
const screenshotPath = await writeNewAttachmentData(screenshotBuffer);
const thumbnailBuffer = await makeImageThumbnailBuffer({

@ -276,8 +276,8 @@ export async function getFileAndStoreLocally(
contentType: attachment.contentType,
fileName: attachment.fileName,
path: attachmentSavedLocally.path,
width: scaled.width,
height: scaled.height,
width: attachmentSavedLocally.width,
height: attachmentSavedLocally.height,
screenshot: attachmentSavedLocally.screenshot,
thumbnail: attachmentSavedLocally.thumbnail,
size: attachmentSavedLocally.size,

Loading…
Cancel
Save