Fix quote content-type for GIFs
This commit is contained in:
parent
1913752fa0
commit
024a3521e1
1 changed files with 6 additions and 5 deletions
|
@ -14,7 +14,7 @@ import {
|
||||||
VerificationOptions,
|
VerificationOptions,
|
||||||
WhatIsThis,
|
WhatIsThis,
|
||||||
} from '../model-types.d';
|
} from '../model-types.d';
|
||||||
import { AttachmentType } from '../types/Attachment';
|
import { AttachmentType, isGIF } from '../types/Attachment';
|
||||||
import { CallMode, CallHistoryDetailsType } from '../types/Calling';
|
import { CallMode, CallHistoryDetailsType } from '../types/Calling';
|
||||||
import * as Stickers from '../types/Stickers';
|
import * as Stickers from '../types/Stickers';
|
||||||
import { CapabilityError } from '../types/errors';
|
import { CapabilityError } from '../types/errors';
|
||||||
|
@ -38,7 +38,7 @@ import { isConversationUnregistered } from '../util/isConversationUnregistered';
|
||||||
import { missingCaseError } from '../util/missingCaseError';
|
import { missingCaseError } from '../util/missingCaseError';
|
||||||
import { sniffImageMimeType } from '../util/sniffImageMimeType';
|
import { sniffImageMimeType } from '../util/sniffImageMimeType';
|
||||||
import { isValidE164 } from '../util/isValidE164';
|
import { isValidE164 } from '../util/isValidE164';
|
||||||
import { MIMEType, IMAGE_WEBP } from '../types/MIME';
|
import { MIMEType, IMAGE_JPEG, IMAGE_GIF, IMAGE_WEBP } from '../types/MIME';
|
||||||
import { UUID } from '../types/UUID';
|
import { UUID } from '../types/UUID';
|
||||||
import {
|
import {
|
||||||
arrayBufferToBase64,
|
arrayBufferToBase64,
|
||||||
|
@ -3148,14 +3148,15 @@ export class ConversationModel extends window.Backbone
|
||||||
attachments,
|
attachments,
|
||||||
attachment => attachment && !attachment.pending && !attachment.error
|
attachment => attachment && !attachment.pending && !attachment.error
|
||||||
);
|
);
|
||||||
const attachmentsToUse = take(validAttachments, 1);
|
const attachmentsToUse = Array.from(take(validAttachments, 1));
|
||||||
|
const isGIFQuote = isGIF(attachmentsToUse);
|
||||||
|
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
map(attachmentsToUse, async attachment => {
|
map(attachmentsToUse, async attachment => {
|
||||||
const { fileName, thumbnail, contentType } = attachment;
|
const { fileName, thumbnail, contentType } = attachment;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
contentType,
|
contentType: isGIFQuote ? IMAGE_GIF : contentType,
|
||||||
// Our protos library complains about this field being undefined, so we force
|
// Our protos library complains about this field being undefined, so we force
|
||||||
// it to null
|
// it to null
|
||||||
fileName: fileName || null,
|
fileName: fileName || null,
|
||||||
|
@ -3233,7 +3234,7 @@ export class ConversationModel extends window.Backbone
|
||||||
return {
|
return {
|
||||||
authorUuid: contact.get('uuid'),
|
authorUuid: contact.get('uuid'),
|
||||||
attachments: isTapToView(quotedMessage.attributes)
|
attachments: isTapToView(quotedMessage.attributes)
|
||||||
? [{ contentType: 'image/jpeg', fileName: null }]
|
? [{ contentType: IMAGE_JPEG, fileName: null }]
|
||||||
: await this.getQuoteAttachment(attachments, preview, sticker),
|
: await this.getQuoteAttachment(attachments, preview, sticker),
|
||||||
bodyRanges: quotedMessage.get('bodyRanges'),
|
bodyRanges: quotedMessage.get('bodyRanges'),
|
||||||
id: quotedMessage.get('sent_at'),
|
id: quotedMessage.get('sent_at'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue