Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3386409
D8645.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8645.diff
View Options
diff --git a/lib/selectors/account-selectors.js b/lib/selectors/account-selectors.js
--- a/lib/selectors/account-selectors.js
+++ b/lib/selectors/account-selectors.js
@@ -2,7 +2,7 @@
import { createSelector } from 'reselect';
-import { cookieSelector } from './keyserver-selectors.js';
+import { cookieSelector, sessionIDSelector } from './keyserver-selectors.js';
import { currentCalendarQuery } from './nav-selectors.js';
import type { LogInExtraInfo } from '../types/account-types.js';
import type { CalendarQuery } from '../types/entry-types.js';
@@ -35,7 +35,7 @@
createSelector(
(state: AppState) => state.currentUserInfo,
cookieSelector,
- (state: AppState) => state.sessionID,
+ sessionIDSelector,
(
currentUserInfo: ?CurrentUserInfo,
cookie: ?string,
diff --git a/lib/selectors/keyserver-selectors.js b/lib/selectors/keyserver-selectors.js
--- a/lib/selectors/keyserver-selectors.js
+++ b/lib/selectors/keyserver-selectors.js
@@ -22,4 +22,7 @@
},
);
-export { cookieSelector, cookiesSelector };
+const sessionIDSelector: (state: AppState) => ?string = (state: AppState) =>
+ state.keyserverStore.keyserverInfos[ashoatKeyserverID]?.sessionID;
+
+export { cookieSelector, cookiesSelector, sessionIDSelector };
diff --git a/lib/selectors/server-calls.js b/lib/selectors/server-calls.js
--- a/lib/selectors/server-calls.js
+++ b/lib/selectors/server-calls.js
@@ -2,7 +2,7 @@
import { createSelector } from 'reselect';
-import { cookieSelector } from './keyserver-selectors.js';
+import { cookieSelector, sessionIDSelector } from './keyserver-selectors.js';
import type { LastCommunicatedPlatformDetails } from '../types/device-types.js';
import type { AppState } from '../types/redux-types.js';
import { type ConnectionStatus } from '../types/socket-types.js';
@@ -21,7 +21,7 @@
createSelector(
cookieSelector,
(state: AppState) => state.urlPrefix,
- (state: AppState) => state.sessionID,
+ sessionIDSelector,
(state: AppState) => state.currentUserInfo,
(state: AppState) => state.connection.status,
(state: AppState) => state.lastCommunicatedPlatformDetails,
diff --git a/lib/shared/session-utils.js b/lib/shared/session-utils.js
--- a/lib/shared/session-utils.js
+++ b/lib/shared/session-utils.js
@@ -1,6 +1,9 @@
// @flow
-import { cookieSelector } from '../selectors/keyserver-selectors.js';
+import {
+ cookieSelector,
+ sessionIDSelector,
+} from '../selectors/keyserver-selectors.js';
import {
logInActionSources,
type LogInActionSource,
@@ -32,7 +35,7 @@
preRequestUserState &&
(preRequestUserState.currentUserInfo?.id !== currentCurrentUserInfo.id ||
preRequestUserState.cookie !== cookieSelector(currentReduxState) ||
- preRequestUserState.sessionID !== currentReduxState.sessionID)
+ preRequestUserState.sessionID !== sessionIDSelector(currentReduxState))
);
}
diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js
--- a/web/redux/redux-setup.js
+++ b/web/redux/redux-setup.js
@@ -36,6 +36,7 @@
import type { CurrentUserInfo, UserStore } from 'lib/types/user-types.js';
import { setNewSessionActionType } from 'lib/utils/action-utils.js';
import type { NotifPermissionAlertInfo } from 'lib/utils/push-alerts.js';
+import { ashoatKeyserverID } from 'lib/utils/validation-utils.js';
import {
updateWindowActiveActionType,
@@ -147,9 +148,20 @@
) {
return oldState;
}
+
state = {
...state,
sessionID: action.payload.sessionChange.sessionID,
+ keyserverStore: {
+ ...state.keyserverStore,
+ keyserverInfos: {
+ ...state.keyserverStore.keyserverInfos,
+ [ashoatKeyserverID]: {
+ ...state.keyserverStore.keyserverInfos[ashoatKeyserverID],
+ sessionID: action.payload.sessionChange.sessionID,
+ },
+ },
+ },
};
} else if (
(action.type === logOutActionTypes.success &&
diff --git a/web/selectors/socket-selectors.js b/web/selectors/socket-selectors.js
--- a/web/selectors/socket-selectors.js
+++ b/web/selectors/socket-selectors.js
@@ -3,6 +3,7 @@
import olm from '@commapp/olm';
import { createSelector } from 'reselect';
+import { sessionIDSelector } from 'lib/selectors/keyserver-selectors.js';
import {
getClientResponsesSelector,
sessionStateFuncSelector,
@@ -35,7 +36,7 @@
const sessionIdentificationSelector: (
state: AppState,
) => SessionIdentification = createSelector(
- (state: AppState) => state.sessionID,
+ sessionIDSelector,
(sessionID: ?string): SessionIdentification => ({ sessionID }),
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 30, 4:34 AM (22 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2599578
Default Alt Text
D8645.diff (4 KB)
Attached To
Mode
D8645: [lib, web] Use sessionId from keyserverStore
Attached
Detach File
Event Timeline
Log In to Comment