Page MenuHomePhabricator

D10505.diff
No OneTemporary

D10505.diff

diff --git a/lib/reducers/keyserver-reducer.js b/lib/reducers/keyserver-reducer.js
--- a/lib/reducers/keyserver-reducer.js
+++ b/lib/reducers/keyserver-reducer.js
@@ -21,6 +21,7 @@
import { setNewSessionKeyserverInfoBase } from '../shared/keyserver-utils.js';
import { queueActivityUpdatesActionType } from '../types/activity-types.js';
import type { KeyserverInfos, KeyserverStore } from '../types/keyserver-types';
+import { defaultKeyserverInfo } from '../types/keyserver-types.js';
import type { BaseAction } from '../types/redux-types.js';
import {
fullStateSyncActionType,
@@ -42,13 +43,32 @@
action: BaseAction,
): KeyserverStore {
if (action.type === addKeyserverActionType) {
+ const keyserverID = action.payload.keyserverAdminUserID;
+
+ let oldKeyserverInfo =
+ state.keyserverInfos[keyserverID] ?? defaultKeyserverInfo;
+ if (
+ oldKeyserverInfo.connection.connectionIssue === 'temporarily_connected'
+ ) {
+ oldKeyserverInfo = {
+ ...oldKeyserverInfo,
+ connection: {
+ ...oldKeyserverInfo.connection,
+ connectionIssue: null,
+ },
+ };
+ }
+
+ const newKeyserverInfo = {
+ ...oldKeyserverInfo,
+ ...action.payload.newKeyserverInfo,
+ };
+
return {
...state,
keyserverInfos: {
...state.keyserverInfos,
- [action.payload.keyserverAdminUserID]: {
- ...action.payload.newKeyserverInfo,
- },
+ [keyserverID]: newKeyserverInfo,
},
};
} else if (action.type === removeKeyserverActionType) {
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
@@ -41,9 +41,14 @@
+keyserverInfo: KeyserverInfo,
};
+export type AddKeyserverInfo = {
+ ...$Partial<KeyserverInfo>,
+ +urlPrefix: string,
+};
+
export type AddKeyserverPayload = {
+keyserverAdminUserID: string,
- +newKeyserverInfo: KeyserverInfo,
+ +newKeyserverInfo: AddKeyserverInfo,
};
export type RemoveKeyserverPayload = {
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
@@ -6,8 +6,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 { defaultKeyserverInfo } from 'lib/types/keyserver-types.js';
+import { type AddKeyserverInfo } from 'lib/types/keyserver-types.js';
import { useDispatch } from 'lib/utils/redux-utils.js';
import type { ProfileNavigationProp } from './profile.react.js';
@@ -55,8 +54,7 @@
return;
}
- const newKeyserverInfo: KeyserverInfo = {
- ...defaultKeyserverInfo,
+ const newKeyserverInfo: AddKeyserverInfo = {
urlPrefix: urlInput,
};
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
@@ -5,8 +5,7 @@
import { addKeyserverActionType } from 'lib/actions/keyserver-actions.js';
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 { defaultKeyserverInfo } from 'lib/types/keyserver-types.js';
+import type { AddKeyserverInfo } from 'lib/types/keyserver-types.js';
import { useDispatch } from 'lib/utils/redux-utils.js';
import css from './add-keyserver-modal.css';
@@ -52,8 +51,7 @@
return;
}
- const newKeyserverInfo: KeyserverInfo = {
- ...defaultKeyserverInfo,
+ const newKeyserverInfo: AddKeyserverInfo = {
urlPrefix: keyserverURL,
};

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 11:13 AM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2590283
Default Alt Text
D10505.diff (3 KB)

Event Timeline