Notifications for a few merge-related scenarios

This commit is contained in:
Scott Nonnenberg 2022-12-05 14:46:54 -08:00 committed by GitHub
parent 78ce34b9d3
commit a49a6f2057
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 2764 additions and 553 deletions

View file

@ -1154,9 +1154,11 @@ export default class MessageReceiver
logId = getEnvelopeId(unsealedEnvelope);
const taskId = `dispatchEvent(EnvelopeEvent(${logId}))`;
this.addToQueue(
async () => this.dispatchEvent(new EnvelopeEvent(unsealedEnvelope)),
`dispatchEvent(EnvelopeEvent(${logId}))`,
async () =>
this.dispatchAndWait(taskId, new EnvelopeEvent(unsealedEnvelope)),
taskId,
TaskType.Decrypted
);
@ -2514,12 +2516,18 @@ export default class MessageReceiver
if (isValid) {
log.info(`${logId}: merging pni=${pni} aci=${aci}`);
window.ConversationController.maybeMergeContacts({
pni,
aci,
e164: window.ConversationController.get(pni)?.get('e164'),
reason: logId,
});
const { mergePromises } =
window.ConversationController.maybeMergeContacts({
pni,
aci,
e164: window.ConversationController.get(pni)?.get('e164'),
fromPniSignature: true,
reason: logId,
});
if (mergePromises.length) {
await Promise.all(mergePromises);
}
}
}