Fix reaction field name in migration 88

This commit is contained in:
Fedor Indutny 2023-08-29 00:03:32 +02:00 committed by GitHub
parent 8aa397b7a6
commit e05de1aa6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 30 deletions

View file

@ -799,11 +799,9 @@ function migrateMessages(db: Database, logger: LoggerType): void {
),
}
: undefined,
reactions: reactions?.map(r =>
migrateReaction(r, 'reactions', logger)
),
reactions: reactions?.map(r => migrateReaction(r)),
storyReaction: storyReaction
? migrateReaction(storyReaction, 'storyReaction', logger)
? migrateReaction(storyReaction)
: undefined,
storyReplyContext: storyReplyContext
? {
@ -1231,22 +1229,13 @@ function migrateBodyRanges(
}
type LegacyReaction = JSONWithUnknownFields<{
authorUuid?: string;
targetAuthorUuid?: string;
}>;
type UpdatedReaction = JSONWithUnknownFields<{
authorAci: AciString | undefined;
}>;
type UpdatedReaction = JSONWithUnknownFields<Record<string, unknown>>;
function migrateReaction(
{ authorUuid, ...legacy }: LegacyReaction,
context: string,
logger: LoggerType
): UpdatedReaction {
return {
...legacy,
authorAci: normalizeAci(authorUuid, context, logger),
};
function migrateReaction(legacy: LegacyReaction): UpdatedReaction {
return omit(legacy, 'targetAuthorUuid');
}
type LegacyGroupChange = JSONWithUnknownFields<{