resetSession: Take both UUID and e164, use each correctly

This commit is contained in:
Scott Nonnenberg 2020-06-08 13:22:26 -07:00
parent ae47748720
commit acf95f4745
3 changed files with 13 additions and 9 deletions

View file

@ -1727,7 +1727,8 @@
message.send( message.send(
this.wrapSend( this.wrapSend(
textsecure.messaging.resetSession( textsecure.messaging.resetSession(
this.get('uuid') || this.get('e164'), this.get('uuid'),
this.get('e164'),
now, now,
options options
) )

View file

@ -583,9 +583,9 @@
nonblockingApproval = false; nonblockingApproval = false;
} }
const identifer = textsecure.utils.unencodeNumber(encodedAddress)[0]; const identifier = textsecure.utils.unencodeNumber(encodedAddress)[0];
const identityRecord = this.getIdentityRecord(identifer); const identityRecord = this.getIdentityRecord(identifier);
const id = ConversationController.getConversationId(identifer); const id = ConversationController.getConversationId(identifier);
if (!identityRecord || !identityRecord.publicKey) { if (!identityRecord || !identityRecord.publicKey) {
// Lookup failed, or the current key was removed, so save this one. // Lookup failed, or the current key was removed, so save this one.
@ -626,7 +626,7 @@
}); });
try { try {
this.trigger('keychange', identifer); this.trigger('keychange', identifier);
} catch (error) { } catch (error) {
window.log.error( window.log.error(
'saveIdentity error triggering keychange:', 'saveIdentity error triggering keychange:',

View file

@ -1221,7 +1221,8 @@ export default class MessageSender {
} }
async resetSession( async resetSession(
identifier: string, uuid: string,
e164: string,
timestamp: number, timestamp: number,
options?: SendOptionsType options?: SendOptionsType
) { ) {
@ -1232,6 +1233,8 @@ export default class MessageSender {
proto.flags = window.textsecure.protobuf.DataMessage.Flags.END_SESSION; proto.flags = window.textsecure.protobuf.DataMessage.Flags.END_SESSION;
proto.timestamp = timestamp; proto.timestamp = timestamp;
const identifier = e164 || uuid;
const logError = (prefix: string) => (error: Error) => { const logError = (prefix: string) => (error: Error) => {
window.log.error(prefix, error && error.stack ? error.stack : error); window.log.error(prefix, error && error.stack ? error.stack : error);
throw error; throw error;
@ -1279,7 +1282,7 @@ export default class MessageSender {
const myNumber = window.textsecure.storage.user.getNumber(); const myNumber = window.textsecure.storage.user.getNumber();
const myUuid = window.textsecure.storage.user.getUuid(); const myUuid = window.textsecure.storage.user.getUuid();
// We already sent the reset session to our other devices in the code above! // 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; return sendToContactPromise;
} }
@ -1287,8 +1290,8 @@ export default class MessageSender {
const sendSyncPromise = this.sendSyncMessage( const sendSyncPromise = this.sendSyncMessage(
buffer, buffer,
timestamp, timestamp,
identifier, e164,
null, uuid,
null, null,
[], [],
[], [],