diff --git a/js/models/conversations.js b/js/models/conversations.js index 4620a9ef2..8162a9fa0 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1727,7 +1727,8 @@ message.send( this.wrapSend( textsecure.messaging.resetSession( - this.get('uuid') || this.get('e164'), + this.get('uuid'), + this.get('e164'), now, options ) diff --git a/js/signal_protocol_store.js b/js/signal_protocol_store.js index f58bf68e0..f2a84a396 100644 --- a/js/signal_protocol_store.js +++ b/js/signal_protocol_store.js @@ -583,9 +583,9 @@ nonblockingApproval = false; } - const identifer = textsecure.utils.unencodeNumber(encodedAddress)[0]; - const identityRecord = this.getIdentityRecord(identifer); - const id = ConversationController.getConversationId(identifer); + const identifier = textsecure.utils.unencodeNumber(encodedAddress)[0]; + const identityRecord = this.getIdentityRecord(identifier); + const id = ConversationController.getConversationId(identifier); if (!identityRecord || !identityRecord.publicKey) { // Lookup failed, or the current key was removed, so save this one. @@ -626,7 +626,7 @@ }); try { - this.trigger('keychange', identifer); + this.trigger('keychange', identifier); } catch (error) { window.log.error( 'saveIdentity error triggering keychange:', diff --git a/ts/textsecure/SendMessage.ts b/ts/textsecure/SendMessage.ts index 91ad8d250..cad52d874 100644 --- a/ts/textsecure/SendMessage.ts +++ b/ts/textsecure/SendMessage.ts @@ -1221,7 +1221,8 @@ export default class MessageSender { } async resetSession( - identifier: string, + uuid: string, + e164: string, timestamp: number, options?: SendOptionsType ) { @@ -1232,6 +1233,8 @@ export default class MessageSender { proto.flags = window.textsecure.protobuf.DataMessage.Flags.END_SESSION; proto.timestamp = timestamp; + const identifier = e164 || uuid; + const logError = (prefix: string) => (error: Error) => { window.log.error(prefix, error && error.stack ? error.stack : error); throw error; @@ -1279,7 +1282,7 @@ export default class MessageSender { const myNumber = window.textsecure.storage.user.getNumber(); const myUuid = window.textsecure.storage.user.getUuid(); // We already sent the reset session to our other devices in the code above! - if (identifier === myNumber || identifier === myUuid) { + if (e164 === myNumber || uuid === myUuid) { return sendToContactPromise; } @@ -1287,8 +1290,8 @@ export default class MessageSender { const sendSyncPromise = this.sendSyncMessage( buffer, timestamp, - identifier, - null, + e164, + uuid, null, [], [],