From 9f73b40d7af24f5790196e201052cace45bf37cd Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 25 Sep 2020 07:20:36 -0700 Subject: [PATCH] MessageReceiver: Use UUID if we have it --- js/background.js | 8 ++++++-- js/modules/metadata/SecretSessionCipher.js | 2 +- ts/services/storageRecordOps.ts | 1 + ts/textsecure/MessageReceiver.ts | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/js/background.js b/js/background.js index 921c0f3da6ee..581f66236966 100644 --- a/js/background.js +++ b/js/background.js @@ -2663,12 +2663,16 @@ let sentTo = []; if (data.unidentifiedStatus && data.unidentifiedStatus.length) { - sentTo = data.unidentifiedStatus.map(item => item.destination); + sentTo = data.unidentifiedStatus.map( + item => item.destinationUuid || item.destination + ); const unidentified = _.filter(data.unidentifiedStatus, item => Boolean(item.unidentified) ); // eslint-disable-next-line no-param-reassign - data.unidentifiedDeliveries = unidentified.map(item => item.destination); + data.unidentifiedDeliveries = unidentified.map( + item => item.destinationUuid || item.destination + ); } return new Whisper.Message({ diff --git a/js/modules/metadata/SecretSessionCipher.js b/js/modules/metadata/SecretSessionCipher.js index c713f7b17a81..d4d7aa82de44 100644 --- a/js/modules/metadata/SecretSessionCipher.js +++ b/js/modules/metadata/SecretSessionCipher.js @@ -517,7 +517,7 @@ SecretSessionCipher.prototype = { const signalProtocolStore = this.storage; const sender = new libsignal.SignalProtocolAddress( - message.senderCertificate.sender || message.senderCertificate.senderUuid, + message.senderCertificate.senderUuid || message.senderCertificate.sender, message.senderCertificate.senderDevice ); diff --git a/ts/services/storageRecordOps.ts b/ts/services/storageRecordOps.ts index 84442f4a7aa3..f44485706f5e 100644 --- a/ts/services/storageRecordOps.ts +++ b/ts/services/storageRecordOps.ts @@ -211,6 +211,7 @@ function applyMessageRequestState( } type RecordClassObject = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; }; diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index 130060a5eaa1..17d77ece0da5 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -839,7 +839,7 @@ class MessageReceiverInner extends EventTarget { let address: SignalProtocolAddressClass; let promise; - const identifier = envelope.source || envelope.sourceUuid; + const identifier = envelope.sourceUuid || envelope.source; address = new window.libsignal.SignalProtocolAddress( // Using source as opposed to sourceUuid allows us to get the existing @@ -1140,7 +1140,7 @@ class MessageReceiverInner extends EventTarget { window.log.info('data message from', this.getEnvelopeId(envelope)); let p: Promise = Promise.resolve(); // eslint-disable-next-line no-bitwise - const destination = envelope.source || envelope.sourceUuid; + const destination = envelope.sourceUuid || envelope.source; if (!destination) { throw new Error( 'MessageReceiver.handleDataMessage: source and sourceUuid were falsey'