Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3352318
D10283.id34610.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10283.id34610.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 5:32 AM (20 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2573591
Default Alt Text
D10283.id34610.diff (1 KB)
Attached To
Mode
D10283: [lib] Update `convertThreadStoreThreadInfosToNewIDSchema` migration to ensure `rawThreadInfos` are NOT minimally encoded
Attached
Detach File
Event Timeline
Log In to Comment