Page MenuHomePhabricator

D10283.id34463.diff
No OneTemporary

D10283.id34463.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 must not be minimallyEncoded',
+ );
+ return [
+ `${ashoatKeyserverID}|` + id,
+ convertRawThreadInfoToNewIDSchema(threadInfo),
+ ];
+ }),
);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 5:17 AM (19 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574070
Default Alt Text
D10283.id34463.diff (1 KB)

Event Timeline