From 9ffa529c302928a6564d87660bce1833255b2e8b Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 30 Aug 2022 14:32:15 +1000 Subject: [PATCH] fix: set flags to VOICE_MESSAGE when sending attachment with voice msg --- ts/models/message.ts | 6 ++++++ ts/session/sending/MessageSender.ts | 1 + ts/util/attachmentsUtil.ts | 2 -- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ts/models/message.ts b/ts/models/message.ts index f93f56573..9671b95d6 100644 --- a/ts/models/message.ts +++ b/ts/models/message.ts @@ -830,6 +830,12 @@ export class MessageModel extends Backbone.Model { fileIdsToLink.push(firstQuoteAttachmentId); } } + + const isFirstAttachmentVoiceMessage = finalAttachments?.[0]?.isVoiceMessage; + if (isFirstAttachmentVoiceMessage) { + attachments[0].flags = SignalService.AttachmentPointer.Flags.VOICE_MESSAGE; + } + window.log.info(`Upload of message data for message ${this.idForLogging()} is finished.`); return { body, diff --git a/ts/session/sending/MessageSender.ts b/ts/session/sending/MessageSender.ts index 57fadc9ed..52c276624 100644 --- a/ts/session/sending/MessageSender.ts +++ b/ts/session/sending/MessageSender.ts @@ -36,6 +36,7 @@ function overwriteOutgoingTimestampWithNetworkTimestamp(message: RawMessage) { const { plainTextBuffer } = message; const contentDecoded = SignalService.Content.decode(plainTextBuffer); + const { dataMessage, dataExtractionNotification, typingMessage } = contentDecoded; if (dataMessage && dataMessage.timestamp && dataMessage.timestamp > 0) { // this is a sync message, do not overwrite the message timestamp diff --git a/ts/util/attachmentsUtil.ts b/ts/util/attachmentsUtil.ts index cedb8a0e5..8637a09a1 100644 --- a/ts/util/attachmentsUtil.ts +++ b/ts/util/attachmentsUtil.ts @@ -332,8 +332,6 @@ export async function getFileAndStoreLocally( screenshot: attachmentSavedLocally.screenshot, thumbnail: attachmentSavedLocally.thumbnail, size: attachmentSavedLocally.size, - - // url: undefined, flags: attachmentFlags || undefined, }; }