Convert message schema migrator to TypeScript

This commit is contained in:
Evan Hahn 2022-05-31 23:56:25 +00:00 committed by GitHub
parent 2a2f44a73a
commit c58f1eb503
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 37 deletions

View file

@ -50,6 +50,7 @@ import { isMoreRecentThan, isOlderThan, toDayMillis } from './util/timestamp';
import { isValidReactionEmoji } from './reactions/isValidReactionEmoji';
import type { ConversationModel } from './models/conversations';
import { getContact } from './messages/helpers';
import { migrateMessageData } from './messages/migrateMessageData';
import { createBatcher } from './util/batcher';
import { updateConversationsWithUuidLookup } from './updateConversationsWithUuidLookup';
import { initializeAllJobQueues } from './jobs/initializeAllJobQueues';
@ -493,7 +494,6 @@ export async function startApp(): Promise<void> {
// of preload.js processing
window.setImmediate = window.nodeSetImmediate;
const { MessageDataMigrator } = window.Signal.Workflow;
const { removeDatabase: removeIndexedDB, doesDatabaseExist } =
window.Signal.IndexedDB;
const { Message } = window.Signal.Types;
@ -827,8 +827,7 @@ export async function startApp(): Promise<void> {
const NUM_MESSAGES_PER_BATCH = 1;
if (!isMigrationWithIndexComplete) {
const batchWithIndex = await MessageDataMigrator.processNext({
BackboneMessageCollection: window.Whisper.MessageCollection,
const batchWithIndex = await migrateMessageData({
numMessagesPerBatch: NUM_MESSAGES_PER_BATCH,
upgradeMessageSchema,
getMessagesNeedingUpgrade: