Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3500736
D8385.id28287.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8385.id28287.diff
View Options
diff --git a/keyserver/src/utils/validation-utils.js b/keyserver/src/utils/validation-utils.js
--- a/keyserver/src/utils/validation-utils.js
+++ b/keyserver/src/utils/validation-utils.js
@@ -5,8 +5,8 @@
import type { PolicyType } from 'lib/facts/policies.js';
import {
hasMinCodeVersion,
- FUTURE_CODE_VERSION,
NEXT_WEB_CODE_VERSION,
+ NEXT_NATIVE_CODE_VERSION,
} from 'lib/shared/version-utils.js';
import { type PlatformDetails } from 'lib/types/device-types.js';
import { ServerError } from 'lib/utils/errors.js';
@@ -39,7 +39,7 @@
if (
hasMinCodeVersion(viewer.platformDetails, {
- native: FUTURE_CODE_VERSION,
+ native: NEXT_NATIVE_CODE_VERSION,
web: NEXT_WEB_CODE_VERSION,
}) &&
convertToNewIDSchema
@@ -74,7 +74,7 @@
if (
(hasMinCodeVersion(platformDetails, {
- native: FUTURE_CODE_VERSION,
+ native: NEXT_NATIVE_CODE_VERSION,
web: NEXT_WEB_CODE_VERSION,
}) &&
convertToNewIDSchema) ||
diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -7,6 +7,15 @@
import { createTransform } from 'redux-persist';
import type { Transform } from 'redux-persist/es/types.js';
+import {
+ convertEntryStoreToNewIDSchema,
+ convertInviteLinksStoreToNewIDSchema,
+ convertMessageStoreToNewIDSchema,
+ convertRawMessageInfoToNewIDSchema,
+ convertRawThreadInfoToNewIDSchema,
+ convertCalendarFilterToNewIDSchema,
+ convertConnectionInfoToNewIDSchema,
+} from 'lib/_generated/migration-utils.js';
import {
type ReportStoreOperation,
type ClientDBReportStoreOperation,
@@ -46,6 +55,8 @@
translateClientDBMessageInfoToRawMessageInfo,
translateRawMessageInfoToClientDBMessageInfo,
} from 'lib/utils/message-ops-utils.js';
+import { generateIDSchemaMigrationOpsForDrafts } from 'lib/utils/migration-utils.js';
+import { entries } from 'lib/utils/objects.js';
import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js';
import {
convertClientDBThreadInfoToRawThreadInfo,
@@ -54,7 +65,11 @@
} from 'lib/utils/thread-ops-utils.js';
import { getUUID } from 'lib/utils/uuid.js';
-import { updateClientDBThreadStoreThreadInfos } from './client-db-utils.js';
+import {
+ updateClientDBMessageStoreMessages,
+ updateClientDBMessageStoreThreads,
+ updateClientDBThreadStoreThreadInfos,
+} from './client-db-utils.js';
import { migrateThreadStoreForEditThreadPermissions } from './edit-thread-permission-migration.js';
import { persistMigrationForManagePinsThreadPermission } from './manage-pins-permission-migration.js';
import type { AppState } from './state-types.js';
@@ -577,6 +592,65 @@
}
return state;
},
+ [43]: async (state: AppState) => {
+ state = await updateClientDBMessageStoreThreads(
+ state,
+ translatedThreadMessageInfos =>
+ Object.fromEntries(
+ entries(translatedThreadMessageInfos).map(
+ ([id, translatedThreadMessageInfo]) => [
+ '256|' + id,
+ translatedThreadMessageInfo,
+ ],
+ ),
+ ),
+ );
+ if (state.cookie === null) {
+ return state;
+ }
+ state = updateClientDBThreadStoreThreadInfos(
+ state,
+ threadStoreThreadInfos =>
+ Object.fromEntries(
+ entries(threadStoreThreadInfos).map(([id, threadInfo]) => [
+ '256|' + id,
+ convertRawThreadInfoToNewIDSchema(threadInfo),
+ ]),
+ ),
+ );
+ if (state.cookie === null) {
+ return state;
+ }
+ state = updateClientDBMessageStoreMessages(state, messageInfos =>
+ messageInfos.map(convertRawMessageInfoToNewIDSchema),
+ );
+ if (state.cookie === null) {
+ return state;
+ }
+
+ const { drafts } = await commCoreModule.getClientDBStore();
+ const draftOperations = generateIDSchemaMigrationOpsForDrafts(drafts);
+ try {
+ commCoreModule.processDraftStoreOperations(draftOperations);
+ } catch (exception) {
+ console.log(exception);
+ return { ...state, cookie: null };
+ }
+
+ return {
+ ...state,
+ entryStore: convertEntryStoreToNewIDSchema(state.entryStore),
+ messageStore: convertMessageStoreToNewIDSchema(state.messageStore),
+ calendarFilters: state.calendarFilters.map(
+ convertCalendarFilterToNewIDSchema,
+ ),
+ connection: convertConnectionInfoToNewIDSchema(state.connection),
+ watchedThreadIDs: state.watchedThreadIDs.map(id => '256|' + id),
+ inviteLinksStore: convertInviteLinksStoreToNewIDSchema(
+ state.inviteLinksStore,
+ ),
+ };
+ },
};
// After migration 31, we'll no longer want to persist `messageStore.messages`
@@ -671,7 +745,7 @@
'storeLoaded',
],
debug: __DEV__,
- version: 42,
+ version: 43,
transforms: [messageStoreMessagesBlocklistTransform, reportStoreTransform],
migrate: (createAsyncMigrate(migrations, { debug: __DEV__ }): any),
timeout: ((__DEV__ ? 0 : undefined): number | void),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 2:37 AM (17 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2684712
Default Alt Text
D8385.id28287.diff (4 KB)
Attached To
Mode
D8385: [native] Migrate to new id schema
Attached
Detach File
Event Timeline
Log In to Comment