Page MenuHomePhabricator

D10484.id35083.diff
No OneTemporary

D10484.id35083.diff

diff --git a/lib/types/keyserver-types.js b/lib/types/keyserver-types.js
--- a/lib/types/keyserver-types.js
+++ b/lib/types/keyserver-types.js
@@ -3,8 +3,11 @@
import t, { type TInterface } from 'tcomb';
import type { PlatformDetails } from './device-types.js';
-import { connectionInfoValidator } from './socket-types.js';
-import type { ConnectionInfo } from './socket-types.js';
+import {
+ type ConnectionInfo,
+ connectionInfoValidator,
+ defaultConnectionInfo,
+} from './socket-types.js';
import type { GlobalAccountUserInfo } from './user-types.js';
import { tShape, tPlatformDetails } from '../utils/validation-utils.js';
@@ -18,6 +21,15 @@
+deviceToken: ?string,
};
+const defaultKeyserverInfo: KeyserverInfo = {
+ cookie: null,
+ updatesCurrentAsOf: 0,
+ urlPrefix: '',
+ connection: defaultConnectionInfo,
+ lastCommunicatedPlatformDetails: null,
+ deviceToken: null,
+};
+
export type KeyserverInfos = { +[key: string]: KeyserverInfo };
export type KeyserverStore = {
@@ -53,3 +65,5 @@
tShape<KeyserverStore>({
keyserverInfos: t.dict(t.String, keyserverInfoValidator),
});
+
+export { defaultKeyserverInfo };
diff --git a/native/profile/add-keyserver.react.js b/native/profile/add-keyserver.react.js
--- a/native/profile/add-keyserver.react.js
+++ b/native/profile/add-keyserver.react.js
@@ -7,7 +7,7 @@
import { addKeyserverActionType } from 'lib/actions/keyserver-actions.js';
import { useIsKeyserverURLValid } from 'lib/shared/keyserver-utils.js';
import type { KeyserverInfo } from 'lib/types/keyserver-types.js';
-import { defaultConnectionInfo } from 'lib/types/socket-types.js';
+import { defaultKeyserverInfo } from 'lib/types/keyserver-types.js';
import { useDispatch } from 'lib/utils/redux-utils.js';
import type { ProfileNavigationProp } from './profile.react.js';
@@ -56,12 +56,8 @@
}
const newKeyserverInfo: KeyserverInfo = {
- cookie: null,
- updatesCurrentAsOf: 0,
+ ...defaultKeyserverInfo,
urlPrefix: urlInput,
- connection: defaultConnectionInfo,
- lastCommunicatedPlatformDetails: null,
- deviceToken: null,
};
dispatch({
diff --git a/web/modals/keyserver-selection/add-keyserver-modal.react.js b/web/modals/keyserver-selection/add-keyserver-modal.react.js
--- a/web/modals/keyserver-selection/add-keyserver-modal.react.js
+++ b/web/modals/keyserver-selection/add-keyserver-modal.react.js
@@ -6,7 +6,7 @@
import { useModalContext } from 'lib/components/modal-provider.react.js';
import { useIsKeyserverURLValid } from 'lib/shared/keyserver-utils.js';
import type { KeyserverInfo } from 'lib/types/keyserver-types.js';
-import { defaultConnectionInfo } from 'lib/types/socket-types.js';
+import { defaultKeyserverInfo } from 'lib/types/keyserver-types.js';
import { useDispatch } from 'lib/utils/redux-utils.js';
import css from './add-keyserver-modal.css';
@@ -53,12 +53,8 @@
}
const newKeyserverInfo: KeyserverInfo = {
- cookie: null,
- updatesCurrentAsOf: 0,
+ ...defaultKeyserverInfo,
urlPrefix: keyserverURL,
- connection: defaultConnectionInfo,
- lastCommunicatedPlatformDetails: null,
- deviceToken: null,
};
dispatch({

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 11:12 AM (4 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2702590
Default Alt Text
D10484.id35083.diff (3 KB)

Event Timeline