Restore PNI when restoring UUID

This commit is contained in:
Fedor Indutny 2023-02-09 15:42:50 -08:00 committed by GitHub
parent da322b8966
commit 88472f7e6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3468,12 +3468,14 @@ export async function startApp(): Promise<void> {
const NUMBER_ID_KEY = 'number_id';
const UUID_ID_KEY = 'uuid_id';
const PNI_KEY = 'pni';
const VERSION_KEY = 'version';
const LAST_PROCESSED_INDEX_KEY = 'attachmentMigration_lastProcessedIndex';
const IS_MIGRATION_COMPLETE_KEY = 'attachmentMigration_isComplete';
const previousNumberId = window.textsecure.storage.get(NUMBER_ID_KEY);
const previousUuidId = window.textsecure.storage.get(UUID_ID_KEY);
const previousPni = window.textsecure.storage.get(PNI_KEY);
const lastProcessedIndex = window.textsecure.storage.get(
LAST_PROCESSED_INDEX_KEY
);
@ -3492,7 +3494,7 @@ export async function startApp(): Promise<void> {
delete conversation.attributes.senderKeyInfo;
});
// These two bits of data are important to ensure that the app loads up
// These three bits of data are important to ensure that the app loads up
// the conversation list, instead of showing just the QR code screen.
if (previousNumberId !== undefined) {
await window.textsecure.storage.put(NUMBER_ID_KEY, previousNumberId);
@ -3500,6 +3502,9 @@ export async function startApp(): Promise<void> {
if (previousUuidId !== undefined) {
await window.textsecure.storage.put(UUID_ID_KEY, previousUuidId);
}
if (previousPni !== undefined) {
await window.textsecure.storage.put(PNI_KEY, previousPni);
}
// These two are important to ensure we don't rip through every message
// in the database attempting to upgrade it after starting up again.