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'));
|
||||
|
|
|
@ -1535,6 +1535,11 @@ class MessageReceiverInner extends EventTarget {
|
|||
while (contactDetails !== undefined) {
|
||||
const contactEvent = new Event('contact');
|
||||
contactEvent.contactDetails = contactDetails;
|
||||
window.normalizeUuids(
|
||||
contactEvent,
|
||||
['contactDetails.verified.destinationUuid'],
|
||||
'message_receiver::handleContacts::handleAttachment'
|
||||
);
|
||||
results.push(this.dispatchAndWait(contactEvent));
|
||||
|
||||
contactDetails = contactBuffer.next();
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
"rule": "jQuery-load(",
|
||||
"path": "js/conversation_controller.js",
|
||||
"line": " async load() {",
|
||||
"lineNumber": 252,
|
||||
"lineNumber": 306,
|
||||
"reasonCategory": "falseMatch",
|
||||
"updated": "2020-06-19T18:29:40.067Z"
|
||||
},
|
||||
|
@ -172,7 +172,7 @@
|
|||
"rule": "jQuery-load(",
|
||||
"path": "js/conversation_controller.js",
|
||||
"line": " this._initialPromise = load();",
|
||||
"lineNumber": 294,
|
||||
"lineNumber": 348,
|
||||
"reasonCategory": "falseMatch",
|
||||
"updated": "2020-06-19T18:29:40.067Z"
|
||||
},
|
||||
|
@ -225,7 +225,7 @@
|
|||
"line": " await wrap(",
|
||||
"lineNumber": 641,
|
||||
"reasonCategory": "falseMatch",
|
||||
"updated": "2020-05-27T21:15:43.044Z"
|
||||
"updated": "2020-06-09T20:26:46.515Z"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-append(",
|
||||
|
@ -325,9 +325,9 @@
|
|||
"rule": "jQuery-load(",
|
||||
"path": "js/signal_protocol_store.js",
|
||||
"line": " await ConversationController.load();",
|
||||
"lineNumber": 985,
|
||||
"lineNumber": 981,
|
||||
"reasonCategory": "falseMatch",
|
||||
"updated": "2020-04-27T20:02:20.424Z"
|
||||
"updated": "2020-06-12T14:20:09.936Z"
|
||||
},
|
||||
{
|
||||
"rule": "DOM-innerHTML",
|
||||
|
@ -11878,4 +11878,4 @@
|
|||
"reasonCategory": "falseMatch",
|
||||
"updated": "2020-04-05T23:45:16.746Z"
|
||||
}
|
||||
]
|
||||
]
|
5
ts/window.d.ts
vendored
5
ts/window.d.ts
vendored
|
@ -96,7 +96,12 @@ export type ConversationControllerType = {
|
|||
identifier: string,
|
||||
type: 'private' | 'group'
|
||||
) => Promise<ConversationType>;
|
||||
getOrCreate: (
|
||||
identifier: string,
|
||||
type: 'private' | 'group'
|
||||
) => ConversationType;
|
||||
getConversationId: (identifier: string) => string | null;
|
||||
ensureContactIds: (o: { e164?: string; uuid?: string }) => string;
|
||||
prepareForSend: (
|
||||
id: string,
|
||||
options: Object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue