Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3355157
D10331.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10331.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 2:01 PM (18 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576167
Default Alt Text
D10331.diff (1 KB)
Attached To
Mode
D10331: [lib] Call logout when connectionIssue is set
Attached
Detach File
Event Timeline
Log In to Comment