Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3379467
D11532.id39052.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
D11532.id39052.diff
View Options
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
@@ -114,6 +114,21 @@
}
}
+ if (
+ (action.type === logOutActionTypes.success ||
+ action.type === deleteAccountActionTypes.success) &&
+ identityInvalidSessionDowngrade(
+ state,
+ action.payload.currentUserInfo,
+ action.payload.preRequestUserState,
+ )
+ ) {
+ return {
+ ...state,
+ loadingStatuses: reduceLoadingStatuses(state.loadingStatuses, action),
+ };
+ }
+
if (
action.type === setNewSessionActionType &&
invalidSessionDowngrade(
@@ -156,45 +171,8 @@
keyserverIDs: newKeyserverIDs,
},
};
- } else if (
- action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
- ) {
- const { currentUserInfo, preRequestUserState } = action.payload;
- if (
- identityInvalidSessionDowngrade(
- state,
- currentUserInfo,
- preRequestUserState,
- )
- ) {
- return {
- ...state,
- loadingStatuses: reduceLoadingStatuses(state.loadingStatuses, action),
- };
- }
-
- state = resetUserSpecificState(
- state,
- defaultState,
- nonUserSpecificFieldsNative,
- );
- } else if (action.type === identityRegisterActionTypes.success) {
- state = resetUserSpecificState(
- state,
- defaultState,
- nonUserSpecificFieldsNative,
- );
- } else if (
- action.type === identityLogInActionTypes.success &&
- action.payload.userID !== action.payload.preRequestUserState?.id
- ) {
- state = resetUserSpecificState(
- state,
- defaultState,
- nonUserSpecificFieldsNative,
- );
}
+
if (
(action.type === setNewSessionActionType &&
action.payload.sessionChange.currentUserInfo &&
@@ -220,6 +198,20 @@
return state;
}
+ if (
+ action.type === logOutActionTypes.success ||
+ action.type === deleteAccountActionTypes.success ||
+ action.type === identityRegisterActionTypes.success ||
+ (action.type === identityLogInActionTypes.success &&
+ action.payload.userID !== action.payload.preRequestUserState?.id)
+ ) {
+ state = resetUserSpecificState(
+ state,
+ defaultState,
+ nonUserSpecificFieldsNative,
+ );
+ }
+
if (action.type === updateDimensionsActiveType) {
return {
...state,
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
@@ -181,6 +181,21 @@
return state;
}
+ if (
+ (action.type === logOutActionTypes.success ||
+ action.type === deleteAccountActionTypes.success) &&
+ identityInvalidSessionDowngrade(
+ oldState,
+ action.payload.currentUserInfo,
+ action.payload.preRequestUserState,
+ )
+ ) {
+ return {
+ ...oldState,
+ loadingStatuses: reduceLoadingStatuses(state.loadingStatuses, action),
+ };
+ }
+
if (action.type === setInitialReduxState) {
const { userInfos, keyserverInfos, actualizedCalendarQuery, ...rest } =
action.payload;
@@ -317,38 +332,14 @@
keyserverIDs: newKeyserverIDs,
},
};
- } else if (
- action.type === logOutActionTypes.success ||
- action.type === deleteAccountActionTypes.success
- ) {
- const { currentUserInfo, preRequestUserState } = action.payload;
- if (
- identityInvalidSessionDowngrade(
- oldState,
- currentUserInfo,
- preRequestUserState,
- )
- ) {
- return {
- ...oldState,
- loadingStatuses: reduceLoadingStatuses(state.loadingStatuses, action),
- };
- }
+ }
- state = resetUserSpecificState(
- state,
- defaultWebState,
- nonUserSpecificFieldsWeb,
- );
- } else if (action.type === identityRegisterActionTypes.success) {
- state = resetUserSpecificState(
- state,
- defaultWebState,
- nonUserSpecificFieldsWeb,
- );
- } else if (
- action.type === identityLogInActionTypes.success &&
- action.payload.userID !== action.payload.preRequestUserState?.id
+ if (
+ action.type === logOutActionTypes.success ||
+ action.type === deleteAccountActionTypes.success ||
+ action.type === identityRegisterActionTypes.success ||
+ (action.type === identityLogInActionTypes.success &&
+ action.payload.userID !== action.payload.preRequestUserState?.id)
) {
state = resetUserSpecificState(
state,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 4:24 PM (20 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594209
Default Alt Text
D11532.id39052.diff (4 KB)
Attached To
Mode
D11532: [web][native] Refactor reset state logic in reducers
Attached
Detach File
Event Timeline
Log In to Comment