Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3397395
D9664.id32999.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9664.id32999.diff
View Options
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
@@ -4,16 +4,20 @@
import { reduceDeviceToken } from './device-token-reducer.js';
import reduceLastCommunicatedPlatformDetails from './last-communicated-platform-details-reducer.js';
import reduceUpdatesCurrentAsOf from './updates-reducer.js';
+import { addKeyserverActionType } from '../actions/keyserver-actions.js';
import { siweAuthActionTypes } from '../actions/siwe-actions.js';
import {
logInActionTypes,
resetUserStateActionType,
+ logOutActionTypes,
+ deleteAccountActionTypes,
} from '../actions/user-actions.js';
import type { KeyserverStore } from '../types/keyserver-types';
import type { BaseAction } from '../types/redux-types.js';
import {
fullStateSyncActionType,
incrementalStateSyncActionType,
+ defaultConnectionInfo,
} from '../types/socket-types.js';
import { processUpdatesActionType } from '../types/update-types.js';
import { setNewSessionActionType } from '../utils/action-utils.js';
@@ -24,8 +28,36 @@
state: KeyserverStore,
action: BaseAction,
): KeyserverStore {
- // this action is only dispatched on native
- if (action.type === resetUserStateActionType) {
+ if (
+ action.type === logOutActionTypes.success ||
+ action.type === deleteAccountActionTypes.success ||
+ (action.type === setNewSessionActionType &&
+ action.payload.sessionChange.cookieInvalidated)
+ ) {
+ return {
+ keyserverInfos: {
+ [ashoatKeyserverID]: {
+ cookie: null,
+ updatesCurrentAsOf: 0,
+ urlPrefix: state.keyserverInfos[ashoatKeyserverID].urlPrefix,
+ connection: defaultConnectionInfo,
+ lastCommunicatedPlatformDetails: null,
+ deviceToken: null,
+ },
+ },
+ };
+ } else if (action.type === addKeyserverActionType) {
+ return {
+ ...state,
+ keyserverInfos: {
+ ...state.keyserverInfos,
+ [action.payload.keyserverAdminUserID]: {
+ ...action.payload.newKeyserverInfo,
+ },
+ },
+ };
+ } else if (action.type === resetUserStateActionType) {
+ // this action is only dispatched on native
const stateCookie = state.keyserverInfos[ashoatKeyserverID]?.cookie;
const cookie =
stateCookie && stateCookie.startsWith('anonymous=') ? stateCookie : null;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 5:30 PM (21 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2608370
Default Alt Text
D9664.id32999.diff (2 KB)
Attached To
Mode
D9664: [lib] add conditions for adding keyserver to the keyserver store
Attached
Detach File
Event Timeline
Log In to Comment