Support for GV1 -> GV2 migration

This commit is contained in:
Scott Nonnenberg 2020-11-20 09:30:45 -08:00 committed by Josh Perez
parent a0baa3e03f
commit 2c69f2c367
32 changed files with 2626 additions and 341 deletions

View file

@ -20,9 +20,7 @@
});
if (syncByE164) {
window.log.info(
`Found early message request response for E164 ${conversation.get(
'e164'
)}`
`Found early message request response for E164 ${conversation.idForLogging()}`
);
this.remove(syncByE164);
return syncByE164;
@ -35,24 +33,35 @@
});
if (syncByUuid) {
window.log.info(
`Found early message request response for UUID ${conversation.get(
'uuid'
)}`
`Found early message request response for UUID ${conversation.idForLogging()}`
);
this.remove(syncByUuid);
return syncByUuid;
}
}
// V1 Group
if (conversation.get('groupId')) {
const syncByGroupId = this.findWhere({
groupId: conversation.get('groupId'),
});
if (syncByGroupId) {
window.log.info(
`Found early message request response for GROUP ID ${conversation.get(
'groupId'
)}`
`Found early message request response for group v1 ID ${conversation.idForLogging()}`
);
this.remove(syncByGroupId);
return syncByGroupId;
}
}
// V2 group
if (conversation.get('groupId')) {
const syncByGroupId = this.findWhere({
groupV2Id: conversation.get('groupId'),
});
if (syncByGroupId) {
window.log.info(
`Found early message request response for group v2 ID ${conversation.idForLogging()}`
);
this.remove(syncByGroupId);
return syncByGroupId;
@ -66,19 +75,29 @@
const threadE164 = sync.get('threadE164');
const threadUuid = sync.get('threadUuid');
const groupId = sync.get('groupId');
const groupV2Id = sync.get('groupV2Id');
const conversation = groupId
? ConversationController.get(groupId)
: ConversationController.get(
ConversationController.ensureContactIds({
e164: threadE164,
uuid: threadUuid,
})
);
let conversation;
// We multiplex between GV1/GV2 groups here, but we don't kick off migrations
if (groupV2Id) {
conversation = ConversationController.get(groupV2Id);
}
if (!conversation && groupId) {
conversation = ConversationController.get(groupId);
}
if (!conversation && (threadE164 || threadUuid)) {
conversation = ConversationController.get(
ConversationController.ensureContactIds({
e164: threadE164,
uuid: threadUuid,
})
);
}
if (!conversation) {
window.log(
`Received message request response for unknown conversation: ${groupId} ${threadUuid} ${threadE164}`
`Received message request response for unknown conversation: groupv2(${groupV2Id}) group(${groupId}) ${threadUuid} ${threadE164}`
);
return;
}