From e052a6743ac5e5cecdf2a187757dcf0e286d12fd Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 1 Mar 2021 16:38:40 +1100 Subject: [PATCH 1/2] fix building of sync message from 1-to-1 convo --- ts/session/messages/outgoing/content/data/ChatMessage.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ts/session/messages/outgoing/content/data/ChatMessage.ts b/ts/session/messages/outgoing/content/data/ChatMessage.ts index fcd5ad6f4..8ae6330c3 100644 --- a/ts/session/messages/outgoing/content/data/ChatMessage.ts +++ b/ts/session/messages/outgoing/content/data/ChatMessage.ts @@ -98,10 +98,10 @@ export class ChatMessage extends DataMessage { ) { if ( (dataMessage as any).constructor.name !== 'DataMessage' && - !(dataMessage instanceof DataMessage) + !(dataMessage instanceof SignalService.DataMessage) ) { - throw new Error( - 'Tried to build a sync message from something else than a DataMessage' + window.log.warn( + 'buildSyncMessage with something else than a DataMessage' ); } From b8a17bcd94e7800f400306b646b096202c72e329 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 1 Mar 2021 16:46:16 +1100 Subject: [PATCH 2/2] do not include lokiProfile on sync Message => we use ConfigMessage now --- .../outgoing/content/data/ChatMessage.ts | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/ts/session/messages/outgoing/content/data/ChatMessage.ts b/ts/session/messages/outgoing/content/data/ChatMessage.ts index 8ae6330c3..628bbd4c0 100644 --- a/ts/session/messages/outgoing/content/data/ChatMessage.ts +++ b/ts/session/messages/outgoing/content/data/ChatMessage.ts @@ -108,23 +108,6 @@ export class ChatMessage extends DataMessage { if (!sentTimestamp || !isNumber(sentTimestamp)) { throw new Error('Tried to build a sync message without a sentTimestamp'); } - // the dataMessage.profileKey is of type ByteBuffer. We need to make it a Uint8Array - const lokiProfile: any = {}; - if (dataMessage.profileKey?.length) { - lokiProfile.profileKey = new Uint8Array( - (dataMessage.profileKey as any).toArrayBuffer() - ); - } - - if (dataMessage.profile) { - if (dataMessage.profile?.displayName) { - lokiProfile.displayName = dataMessage.profile.displayName; - } - if (dataMessage.profile?.profilePicture) { - lokiProfile.avatarPointer = dataMessage.profile.profilePicture; - } - } - const timestamp = toNumber(sentTimestamp); const body = dataMessage.body || undefined; const attachments = (dataMessage.attachments || []).map(attachment => { @@ -147,7 +130,6 @@ export class ChatMessage extends DataMessage { attachments, body, quote, - lokiProfile, preview, syncTarget, });