Page MenuHomePhabricator

D10283.id34674.diff
No OneTemporary

D10283.id34674.diff

diff --git a/lib/utils/migration-utils.js b/lib/utils/migration-utils.js
--- a/lib/utils/migration-utils.js
+++ b/lib/utils/migration-utils.js
@@ -1,5 +1,7 @@
// @flow
+import invariant from 'invariant';
+
import type { TranslatedThreadMessageInfos } from './message-ops-utils.js';
import { entries } from './objects.js';
import { ashoatKeyserverID } from './validation-utils.js';
@@ -23,7 +25,7 @@
threadPermissionPropagationPrefixes,
threadPermissionFilterPrefixes,
} from '../types/thread-permission-types.js';
-import type { ThreadStoreThreadInfos } from '../types/thread-types.js';
+import type { RawThreadInfos } from '../types/thread-types.js';
function convertDraftKeyToNewIDSchema(key: string): string {
const threadID = key.slice(0, -draftKeySuffix.length);
@@ -67,13 +69,19 @@
}
function convertThreadStoreThreadInfosToNewIDSchema(
- threadStoreThreadInfos: ThreadStoreThreadInfos,
-): ThreadStoreThreadInfos {
+ threadStoreThreadInfos: RawThreadInfos,
+): RawThreadInfos {
return Object.fromEntries(
- entries(threadStoreThreadInfos).map(([id, threadInfo]) => [
- `${ashoatKeyserverID}|` + id,
- convertRawThreadInfoToNewIDSchema(threadInfo),
- ]),
+ entries(threadStoreThreadInfos).map(([id, threadInfo]) => {
+ invariant(
+ !threadInfo.minimallyEncoded,
+ `threadInfo during ID schema migration shouldn't be minimallyEncoded`,
+ );
+ return [
+ `${ashoatKeyserverID}|` + id,
+ convertRawThreadInfoToNewIDSchema(threadInfo),
+ ];
+ }),
);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 9:39 PM (21 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2432630
Default Alt Text
D10283.id34674.diff (1 KB)

Event Timeline