Page MenuHomePhabricator

D10331.id34899.diff
No OneTemporary

D10331.id34899.diff

diff --git a/lib/components/keyserver-connection-handler.js b/lib/components/keyserver-connection-handler.js
--- a/lib/components/keyserver-connection-handler.js
+++ b/lib/components/keyserver-connection-handler.js
@@ -2,7 +2,11 @@
import * as React from 'react';
+import { logOutActionTypes, useLogOut } from '../actions/user-actions.js';
+import { connectionSelector } from '../selectors/keyserver-selectors.js';
import type { BaseSocketProps } from '../socket/socket.react.js';
+import { useDispatchActionPromise } from '../utils/action-utils.js';
+import { useSelector } from '../utils/redux-utils.js';
import { ashoatKeyserverID } from '../utils/validation-utils.js';
type Props = {
@@ -12,6 +16,20 @@
};
function KeyserverConnectionHandler(props: Props) {
const { socketComponent: Socket, keyserverID, ...rest } = props;
+
+ const dispatchActionPromise = useDispatchActionPromise();
+ const callLogOut = useLogOut();
+
+ const hasConnectionIssue = useSelector(
+ state => !!connectionSelector(keyserverID)(state)?.connectionIssue,
+ );
+
+ React.useEffect(() => {
+ if (hasConnectionIssue) {
+ void dispatchActionPromise(logOutActionTypes, callLogOut());
+ }
+ }, [callLogOut, hasConnectionIssue, dispatchActionPromise]);
+
if (keyserverID !== ashoatKeyserverID) {
return null;
}
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
@@ -306,7 +306,11 @@
const keyserverInfos = {
[ashoatKeyserverID]: {
...state.keyserverInfos[ashoatKeyserverID],
- connection: { ...oldConnection, queuedActivityUpdates: [] },
+ connection: {
+ ...oldConnection,
+ connectionIssue: null,
+ queuedActivityUpdates: [],
+ },
},
};

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 3:37 PM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576167
Default Alt Text
D10331.id34899.diff (1 KB)

Event Timeline