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 { } else {
// scale them down // scale them down
const files = await Promise.all(stagedAttachments.map(AttachmentUtil.getFileAndStoreLocally)); const files = await Promise.all(stagedAttachments.map(AttachmentUtil.getFileAndStoreLocally));
attachments = _.compact(files); attachments = _.compact(files);
} }

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

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

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

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

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

Loading…
Cancel
Save