Notifications for a few merge-related scenarios
This commit is contained in:
parent
78ce34b9d3
commit
a49a6f2057
40 changed files with 2764 additions and 553 deletions
|
@ -620,15 +620,15 @@ export default class AccountManager extends EventTarget {
|
|||
// This needs to be done very early, because it changes how things are saved in the
|
||||
// database. Your identity, for example, in the saveIdentityWithAttributes call
|
||||
// below.
|
||||
const conversationId = window.ConversationController.maybeMergeContacts({
|
||||
const { conversation } = window.ConversationController.maybeMergeContacts({
|
||||
aci: ourUuid,
|
||||
pni: ourPni,
|
||||
e164: number,
|
||||
reason: 'createAccount',
|
||||
});
|
||||
|
||||
if (!conversationId) {
|
||||
throw new Error('registrationDone: no conversationId!');
|
||||
if (!conversation) {
|
||||
throw new Error('registrationDone: no conversation!');
|
||||
}
|
||||
|
||||
const identityAttrs = {
|
||||
|
|
|
@ -5,17 +5,15 @@ import type { UUID } from '../types/UUID';
|
|||
import type { SignalProtocolStore } from '../SignalProtocolStore';
|
||||
|
||||
export function init(signalProtocolStore: SignalProtocolStore): void {
|
||||
signalProtocolStore.on('keychange', async (uuid: UUID): Promise<void> => {
|
||||
const conversation = await window.ConversationController.getOrCreateAndWait(
|
||||
uuid.toString(),
|
||||
'private'
|
||||
);
|
||||
conversation.addKeyChange(uuid);
|
||||
|
||||
const groups =
|
||||
await window.ConversationController.getAllGroupsInvolvingUuid(uuid);
|
||||
for (const group of groups) {
|
||||
group.addKeyChange(uuid);
|
||||
signalProtocolStore.on(
|
||||
'keychange',
|
||||
async (uuid: UUID, reason: string): Promise<void> => {
|
||||
const conversation =
|
||||
await window.ConversationController.getOrCreateAndWait(
|
||||
uuid.toString(),
|
||||
'private'
|
||||
);
|
||||
conversation.addKeyChange(reason);
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue