Harden UUID-handling code paths
This commit is contained in:
parent
d3a27a6442
commit
bf04c9114e
10 changed files with 193 additions and 124 deletions
|
@ -693,19 +693,14 @@ export default class AccountManager extends EventTarget {
|
|||
async registrationDone({ uuid, number }: { uuid?: string; number?: string }) {
|
||||
window.log.info('registration done');
|
||||
|
||||
const identifier = number || uuid;
|
||||
if (!identifier) {
|
||||
throw new Error('registrationDone: no identifier!');
|
||||
const conversationId = window.ConversationController.ensureContactIds({
|
||||
e164: number,
|
||||
uuid,
|
||||
});
|
||||
if (!conversationId) {
|
||||
throw new Error('registrationDone: no conversationId!');
|
||||
}
|
||||
|
||||
// Ensure that we always have a conversation for ourself
|
||||
const conversation = await window.ConversationController.getOrCreateAndWait(
|
||||
identifier,
|
||||
'private'
|
||||
);
|
||||
conversation.updateE164(number);
|
||||
conversation.updateUuid(uuid);
|
||||
|
||||
window.log.info('dispatching registration event');
|
||||
|
||||
this.dispatchEvent(new Event('registration'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue