MessageReceiver: Use UUID if we have it

This commit is contained in:
Scott Nonnenberg 2020-09-25 07:20:36 -07:00 committed by GitHub
parent 8e656c2cf1
commit 9f73b40d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 5 deletions

View file

@ -2663,12 +2663,16 @@
let sentTo = []; let sentTo = [];
if (data.unidentifiedStatus && data.unidentifiedStatus.length) { 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 => const unidentified = _.filter(data.unidentifiedStatus, item =>
Boolean(item.unidentified) Boolean(item.unidentified)
); );
// eslint-disable-next-line no-param-reassign // 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({ return new Whisper.Message({

View file

@ -517,7 +517,7 @@ SecretSessionCipher.prototype = {
const signalProtocolStore = this.storage; const signalProtocolStore = this.storage;
const sender = new libsignal.SignalProtocolAddress( const sender = new libsignal.SignalProtocolAddress(
message.senderCertificate.sender || message.senderCertificate.senderUuid, message.senderCertificate.senderUuid || message.senderCertificate.sender,
message.senderCertificate.senderDevice message.senderCertificate.senderDevice
); );

View file

@ -211,6 +211,7 @@ function applyMessageRequestState(
} }
type RecordClassObject = { type RecordClassObject = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any; [key: string]: any;
}; };

View file

@ -839,7 +839,7 @@ class MessageReceiverInner extends EventTarget {
let address: SignalProtocolAddressClass; let address: SignalProtocolAddressClass;
let promise; let promise;
const identifier = envelope.source || envelope.sourceUuid; const identifier = envelope.sourceUuid || envelope.source;
address = new window.libsignal.SignalProtocolAddress( address = new window.libsignal.SignalProtocolAddress(
// Using source as opposed to sourceUuid allows us to get the existing // 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)); window.log.info('data message from', this.getEnvelopeId(envelope));
let p: Promise<any> = Promise.resolve(); let p: Promise<any> = Promise.resolve();
// eslint-disable-next-line no-bitwise // eslint-disable-next-line no-bitwise
const destination = envelope.source || envelope.sourceUuid; const destination = envelope.sourceUuid || envelope.source;
if (!destination) { if (!destination) {
throw new Error( throw new Error(
'MessageReceiver.handleDataMessage: source and sourceUuid were falsey' 'MessageReceiver.handleDataMessage: source and sourceUuid were falsey'