Harden UUID-handling code paths

This commit is contained in:
Ken Powers 2020-06-12 18:36:32 -04:00 committed by Scott Nonnenberg
parent d3a27a6442
commit bf04c9114e
10 changed files with 193 additions and 124 deletions

View file

@ -17,12 +17,11 @@ function refreshOurProfile() {
window.log.info('refreshOurProfile');
const ourNumber = textsecure.storage.user.getNumber();
const ourUuid = textsecure.storage.user.getUuid();
const conversation = ConversationController.getOrCreate(
// This is explicitly ourNumber first in order to avoid creating new
// conversations when an old one exists
ourNumber || ourUuid,
'private'
);
const ourId = ConversationController.ensureContactIds({
e164: ourNumber,
uuid: ourUuid,
});
const conversation = ConversationController.get(ourId, 'private');
conversation.updateUuid(ourUuid);
conversation.updateE164(ourNumber);
conversation.getProfiles();