Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3497036
D8386.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D8386.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,7 +5,7 @@
import type { PolicyType } from 'lib/facts/policies.js';
import {
hasMinCodeVersion,
- FUTURE_CODE_VERSION,
+ hasMinStateVersion,
} from 'lib/shared/version-utils.js';
import { type PlatformDetails } from 'lib/types/device-types.js';
import { ServerError } from 'lib/utils/errors.js';
@@ -15,7 +15,6 @@
tPlatform,
tPlatformDetails,
assertWithValidator,
- convertToNewIDSchema,
keyserverPrefixID,
convertClientIDsToServerIDs,
convertObject,
@@ -37,11 +36,10 @@
const convertedInput = checkInputValidator(inputValidator, input);
if (
- hasMinCodeVersion(viewer.platformDetails, {
- native: FUTURE_CODE_VERSION,
- web: FUTURE_CODE_VERSION,
- }) &&
- convertToNewIDSchema
+ hasMinStateVersion(viewer.platformDetails, {
+ native: 43,
+ web: 3,
+ })
) {
try {
return convertClientIDsToServerIDs(
@@ -72,12 +70,11 @@
}
if (
- (hasMinCodeVersion(platformDetails, {
- native: FUTURE_CODE_VERSION,
- web: FUTURE_CODE_VERSION,
+ hasMinStateVersion(platformDetails, {
+ native: 43,
+ web: 3,
}) ||
- alwaysConvertSchema) &&
- convertToNewIDSchema
+ alwaysConvertSchema
) {
return convertServerIDsToClientIDs(
keyserverPrefixID,
diff --git a/lib/_generated/migration-utils.js b/lib/_generated/migration-utils.js
--- a/lib/_generated/migration-utils.js
+++ b/lib/_generated/migration-utils.js
@@ -1,16 +1,8 @@
// @flow
-import type { EntryStore } from '../types/entry-types.js';
-import type { CalendarFilter } from '../types/filter-types.js';
-import type { InviteLinksStore } from '../types/link-types.js';
-import type { MessageStore, RawMessageInfo } from '../types/message-types.js';
-import type { ConnectionInfo } from '../types/socket-types.js';
-import type { RawThreadInfo } from '../types/thread-types.js';
import { entries } from '../utils/objects.js';
-export function convertRawMessageInfoToNewIDSchema(
- input: RawMessageInfo,
-): RawMessageInfo {
+export function convertRawMessageInfoToNewIDSchema(input: any): any {
return input.type === 0
? {
...input,
@@ -366,9 +358,7 @@
: input;
}
-export function convertRawThreadInfoToNewIDSchema(
- input: RawThreadInfo,
-): RawThreadInfo {
+export function convertRawThreadInfoToNewIDSchema(input: any): any {
return {
...input,
id: '256|' + input.id,
@@ -428,9 +418,7 @@
};
}
-export function convertMessageStoreToNewIDSchema(
- input: MessageStore,
-): MessageStore {
+export function convertMessageStoreToNewIDSchema(input: any): any {
return {
...input,
messages: Object.fromEntries(
@@ -832,7 +820,7 @@
};
}
-export function convertEntryStoreToNewIDSchema(input: EntryStore): EntryStore {
+export function convertEntryStoreToNewIDSchema(input: any): any {
return {
...input,
entryInfos: Object.fromEntries(
@@ -857,9 +845,7 @@
};
}
-export function convertInviteLinksStoreToNewIDSchema(
- input: InviteLinksStore,
-): InviteLinksStore {
+export function convertInviteLinksStoreToNewIDSchema(input: any): any {
return {
...input,
links: Object.fromEntries(
@@ -881,17 +867,13 @@
};
}
-export function convertCalendarFilterToNewIDSchema(
- input: CalendarFilter,
-): CalendarFilter {
+export function convertCalendarFilterToNewIDSchema(input: any): any {
return input.type === 'threads'
? { ...input, threadIDs: input.threadIDs.map(elem => '256|' + elem) }
: input;
}
-export function convertConnectionInfoToNewIDSchema(
- input: ConnectionInfo,
-): ConnectionInfo {
+export function convertConnectionInfoToNewIDSchema(input: any): any {
return {
...input,
queuedActivityUpdates: input.queuedActivityUpdates.map(elem => ({
diff --git a/lib/facts/genesis.js b/lib/facts/genesis.js
--- a/lib/facts/genesis.js
+++ b/lib/facts/genesis.js
@@ -1,7 +1,5 @@
// @flow
-import { convertToNewIDSchema } from '../utils/validation-utils.js';
-
type Genesis = {
+id: string,
+name: string,
@@ -10,7 +8,7 @@
};
const genesis: Genesis = {
- id: process.env['KEYSERVER'] || !convertToNewIDSchema ? '1' : '256|1',
+ id: process.env['KEYSERVER'] ? '1' : '256|1',
name: 'GENESIS',
description:
'This is the first community on Comm. In the future it will be possible to create chats outside of a community, but for now all of these chats get set with GENESIS as their parent. GENESIS is hosted on Ashoat’s keyserver.',
diff --git a/lib/selectors/socket-selectors.js b/lib/selectors/socket-selectors.js
--- a/lib/selectors/socket-selectors.js
+++ b/lib/selectors/socket-selectors.js
@@ -42,7 +42,6 @@
tID,
convertClientIDsToServerIDs,
keyserverPrefixID,
- convertToNewIDSchema,
} from '../utils/validation-utils.js';
const queuedReports: (
@@ -75,23 +74,21 @@
currentUserInfo: ?CurrentUserInfo,
calendarQuery: (calendarActive: boolean) => CalendarQuery,
) => {
- if (convertToNewIDSchema) {
- threadInfos = convertClientIDsToServerIDs(
- keyserverPrefixID,
- t.dict(tID, rawThreadInfoValidator),
- threadInfos,
- );
- userInfos = convertClientIDsToServerIDs(
- keyserverPrefixID,
- userInfosValidator,
- userInfos,
- );
- currentUserInfo = convertClientIDsToServerIDs(
- keyserverPrefixID,
- t.maybe(currentUserInfoValidator),
- currentUserInfo,
- );
- }
+ threadInfos = convertClientIDsToServerIDs(
+ keyserverPrefixID,
+ t.dict(tID, rawThreadInfoValidator),
+ threadInfos,
+ );
+ userInfos = convertClientIDsToServerIDs(
+ keyserverPrefixID,
+ userInfosValidator,
+ userInfos,
+ );
+ currentUserInfo = convertClientIDsToServerIDs(
+ keyserverPrefixID,
+ t.maybe(currentUserInfoValidator),
+ currentUserInfo,
+ );
return async (
calendarActive: boolean,
@@ -124,13 +121,11 @@
calendarQuery(calendarActive),
);
- if (convertToNewIDSchema) {
- filteredEntryInfos = convertClientIDsToServerIDs(
- keyserverPrefixID,
- t.dict(tID, rawEntryInfoValidator),
- filteredEntryInfos,
- );
- }
+ filteredEntryInfos = convertClientIDsToServerIDs(
+ keyserverPrefixID,
+ t.dict(tID, rawEntryInfoValidator),
+ filteredEntryInfos,
+ );
const hashResults = {};
for (const key in serverRequest.hashesToCheck) {
diff --git a/lib/utils/validation-utils.js b/lib/utils/validation-utils.js
--- a/lib/utils/validation-utils.js
+++ b/lib/utils/validation-utils.js
@@ -103,7 +103,6 @@
return (data: any);
}
-const convertToNewIDSchema = false;
const keyserverPrefixID = '256';
function convertServerIDsToClientIDs<T>(
@@ -242,7 +241,6 @@
tMediaMessageVideo,
tMediaMessageMedia,
assertWithValidator,
- convertToNewIDSchema,
keyserverPrefixID,
convertClientIDsToServerIDs,
convertServerIDsToClientIDs,
diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -742,7 +742,7 @@
'storeLoaded',
],
debug: __DEV__,
- version: 42,
+ version: 43,
transforms: [messageStoreMessagesBlocklistTransform, reportStoreTransform],
migrate: (createAsyncMigrate(migrations, { debug: __DEV__ }): any),
timeout: ((__DEV__ ? 0 : undefined): number | void),
diff --git a/web/redux/persist.js b/web/redux/persist.js
--- a/web/redux/persist.js
+++ b/web/redux/persist.js
@@ -137,7 +137,7 @@
{ debug: isDev },
migrateStorageToSQLite,
): any),
- version: 2,
+ version: 3,
};
export { persistConfig };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 5:43 PM (17 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2682135
Default Alt Text
D8386.diff (7 KB)
Attached To
Mode
D8386: [lib] Enable new id schema
Attached
Detach File
Event Timeline
Log In to Comment