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

@ -1228,10 +1228,11 @@
return null;
}
return ConversationController.getOrCreate(
source || sourceUuid,
'private'
);
const contactId = ConversationController.ensureContactIds({
e164: source,
uuid: sourceUuid,
});
return ConversationController.get(contactId, 'private');
},
isOutgoing() {
return this.get('type') === 'outgoing';
@ -2562,12 +2563,13 @@
} else if (conversation.isPrivate()) {
conversation.setProfileKey(profileKey);
} else {
ConversationController.getOrCreateAndWait(
source || sourceUuid,
'private'
).then(sender => {
sender.setProfileKey(profileKey);
const localId = ConversationController.ensureContactIds({
e164: source,
uuid: sourceUuid,
});
ConversationController.get(localId, 'private').setProfileKey(
profileKey
);
}
}