Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3528243
D8536.id28924.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D8536.id28924.diff
View Options
diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -234,7 +234,6 @@
}),
),
nextLocalID: tNumber(0),
- cookie: t.Nil,
deviceToken: t.Nil,
dataLoaded: t.Boolean,
windowActive: tBool(true),
@@ -588,7 +587,6 @@
queuedReports: [],
},
nextLocalID: 0,
- cookie: undefined,
deviceToken: null,
dataLoaded: viewer.loggedIn,
windowActive: true,
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
@@ -7,8 +7,7 @@
import { ashoatKeyserverID } from '../utils/validation-utils.js';
const cookieSelector: (state: AppState) => ?string = (state: AppState) =>
- state.keyserverStore.keyserverInfos[ashoatKeyserverID]?.cookie ??
- state.cookie;
+ state.keyserverStore.keyserverInfos[ashoatKeyserverID]?.cookie;
const cookiesSelector: (state: AppState) => {
+[keyserverID: string]: string,
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -147,12 +147,10 @@
// Native JS doesn't have a sessionID because the cookieID is used instead.
export type NativeAppState = BaseAppState<*> & {
sessionID?: void,
- cookie: ?string,
...
};
export type WebAppState = BaseAppState<*> & {
sessionID: ?string,
- cookie?: void,
cryptoStore: CryptoStore,
pushApiPublicKey: ?string,
...
diff --git a/lib/utils/sanitization.js b/lib/utils/sanitization.js
--- a/lib/utils/sanitization.js
+++ b/lib/utils/sanitization.js
@@ -5,11 +5,7 @@
import { setNewSessionActionType } from './action-utils.js';
import { setDeviceTokenActionTypes } from '../actions/device-actions.js';
-import type {
- BaseAction,
- NativeAppState,
- AppState,
-} from '../types/redux-types.js';
+import type { BaseAction, AppState } from '../types/redux-types.js';
export type ReduxCrashReport = {
+preloadedState: AppState,
@@ -299,18 +295,18 @@
state: AppState,
redactionHelpers: RedactionHelpers,
): AppState {
- if (state.cookie !== undefined && state.cookie !== null) {
- const oldState: NativeAppState = state;
- const keyserverInfos = { ...oldState.keyserverStore.keyserverInfos };
- for (const key in keyserverInfos) {
- keyserverInfos[key] = { ...keyserverInfos[key], cookie: null };
+ const keyserverInfos = { ...state.keyserverStore.keyserverInfos };
+ for (const key in keyserverInfos) {
+ if (keyserverInfos[key].cookie === undefined) {
+ continue;
}
- const keyserverStore = { ...oldState.keyserverStore, keyserverInfos };
- state = { ...oldState, cookie: null, keyserverStore };
+ keyserverInfos[key] = { ...keyserverInfos[key], cookie: null };
}
+ const keyserverStore = { ...state.keyserverStore, keyserverInfos };
+ state = { ...state, keyserverStore };
+
if (state.deviceToken !== undefined && state.deviceToken !== null) {
- const oldState: AppState = state;
- state = { ...oldState, deviceToken: null };
+ state = { ...state, deviceToken: null };
}
const stateCopy = clone(state);
sanitizePII(stateCopy, redactionHelpers);
diff --git a/native/redux/client-db-utils.js b/native/redux/client-db-utils.js
--- a/native/redux/client-db-utils.js
+++ b/native/redux/client-db-utils.js
@@ -46,7 +46,15 @@
commCoreModule.processThreadStoreOperationsSync(operations);
} catch (exception) {
console.log(exception);
- return { ...state, cookie: null };
+ const keyserverInfos = { ...state.keyserverStore.keyserverInfos };
+ for (const key in keyserverInfos) {
+ keyserverInfos[key] = { ...keyserverInfos[key], cookie: null };
+ }
+ const keyserverStore = { ...state.keyserverStore, keyserverInfos };
+ return {
+ ...state,
+ keyserverStore,
+ };
}
return state;
diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -648,6 +648,14 @@
),
};
},
+ [44]: async state => {
+ const { cookie, ...rest } = state;
+
+ return {
+ ...rest,
+ keyserverStore: { keyserverInfos: { [ashoatKeyserverID]: cookie } },
+ };
+ },
};
// After migration 31, we'll no longer want to persist `messageStore.messages`
@@ -742,7 +750,7 @@
'storeLoaded',
],
debug: __DEV__,
- version: 43,
+ version: 44,
transforms: [messageStoreMessagesBlocklistTransform, reportStoreTransform],
migrate: (createAsyncMigrate(migrations, { debug: __DEV__ }): any),
timeout: ((__DEV__ ? 0 : undefined): number | void),
diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js
--- a/native/redux/redux-setup.js
+++ b/native/redux/redux-setup.js
@@ -12,7 +12,6 @@
logOutActionTypes,
deleteAccountActionTypes,
logInActionTypes,
- resetUserStateActionType,
} from 'lib/actions/user-actions.js';
import baseReducer from 'lib/reducers/master-reducer.js';
import { processThreadStoreOperations } from 'lib/reducers/thread-reducer.js';
@@ -91,7 +90,6 @@
updatesCurrentAsOf: 0,
loadingStatuses: {},
calendarFilters: defaultCalendarFilters,
- cookie: null,
deviceToken: null,
dataLoaded: false,
urlPrefix: defaultURLPrefix,
@@ -298,10 +296,6 @@
if (action.type === setNewSessionActionType) {
sessionInvalidationAlert(action.payload);
- state = {
- ...state,
- cookie: action.payload.sessionChange.cookie,
- };
}
if (action.type === setStoreLoadedActionType) {
return {
@@ -329,16 +323,6 @@
return state;
}
}
- if (action.type === resetUserStateActionType) {
- const cookie =
- state.cookie && state.cookie.startsWith('anonymous=')
- ? state.cookie
- : null;
- state = {
- ...state,
- cookie,
- };
- }
const baseReducerResult = baseReducer(state, (action: BaseAction));
state = baseReducerResult.state;
diff --git a/native/redux/state-types.js b/native/redux/state-types.js
--- a/native/redux/state-types.js
+++ b/native/redux/state-types.js
@@ -38,7 +38,6 @@
updatesCurrentAsOf: number,
loadingStatuses: { [key: string]: { [idx: number]: LoadingStatus } },
calendarFilters: $ReadOnlyArray<CalendarFilter>,
- cookie: ?string,
deviceToken: ?string,
dataLoaded: boolean,
urlPrefix: string,
diff --git a/native/redux/unshim-utils.js b/native/redux/unshim-utils.js
--- a/native/redux/unshim-utils.js
+++ b/native/redux/unshim-utils.js
@@ -61,7 +61,6 @@
const keyserverStore = { ...state.keyserverStore, keyserverInfos };
return {
...state,
- cookie: null,
keyserverStore,
};
}
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
@@ -82,7 +82,6 @@
communityPickerStore: CommunityPickerStore,
urlPrefix: string,
windowDimensions: WindowDimensions,
- cookie?: void,
deviceToken: ?string,
baseHref: string,
notifPermissionAlertInfo: NotifPermissionAlertInfo,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 8:46 AM (11 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700594
Default Alt Text
D8536.id28924.diff (7 KB)
Attached To
Mode
D8536: [lib, keyserver, native, web] Remove the cookie field from redux
Attached
Detach File
Event Timeline
Log In to Comment