Page MenuHomePhabricator

D8536.id28789.diff
No OneTemporary

D8536.id28789.diff

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 { keyserverPrefixID } from '../utils/validation-utils.js';
const cookieSelector: (state: AppState) => ?string = (state: AppState) =>
- state.keyserverStore.keyserverInfos[keyserverPrefixID]?.cookie ??
- state.cookie;
+ state.keyserverStore.keyserverInfos[keyserverPrefixID]?.cookie;
const cookiesSelector: (state: AppState) => {
+[communityID: 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: { [keyserverPrefixID]: cookie } },
+ };
+ },
};
// After migration 31, we'll no longer want to persist `messageStore.messages`
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/persist.js b/web/redux/persist.js
--- a/web/redux/persist.js
+++ b/web/redux/persist.js
@@ -94,6 +94,14 @@
return newState;
},
+ [4]: async state => {
+ const { cookie, ...rest } = state;
+
+ return {
+ ...rest,
+ keyserverStore: { keyserverInfos: {} },
+ };
+ },
};
const persistWhitelist = [
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

Mime Type
text/plain
Expires
Wed, Dec 25, 2:34 AM (5 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2701390
Default Alt Text
D8536.id28789.diff (7 KB)

Event Timeline