Page MenuHomePhabricator

D11140.diff
No OneTemporary

D11140.diff

diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js
--- a/lib/actions/user-actions.js
+++ b/lib/actions/user-actions.js
@@ -399,7 +399,7 @@
return {
threadInfos,
- currentUserInfo: responses[authoritativeKeyserverID()].currentUserInfo,
+ currentUserInfo: responses[authoritativeKeyserverID()]?.currentUserInfo,
calendarResult,
messagesResult,
userInfos,
diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js
--- a/lib/reducers/user-reducer.js
+++ b/lib/reducers/user-reducer.js
@@ -10,6 +10,8 @@
newThreadActionTypes,
} from '../actions/thread-actions.js';
import {
+ identityLogInActionTypes,
+ identityRegisterActionTypes,
deleteAccountActionTypes,
keyserverAuthActionTypes,
logOutActionTypes,
@@ -55,6 +57,35 @@
action: BaseAction,
): ?CurrentUserInfo {
if (
+ action.type === identityLogInActionTypes.success ||
+ action.type === identityRegisterActionTypes.success
+ ) {
+ const newUserInfo = {
+ id: action.payload.userID,
+ username: action.payload.username,
+ };
+ if (!_isEqual(newUserInfo)(state)) {
+ return newUserInfo;
+ }
+ } else if (action.type === keyserverAuthActionTypes.success) {
+ const { currentUserInfo: actionUserInfo } = action.payload;
+ if (actionUserInfo) {
+ if (!state?.id || actionUserInfo.id !== state.id) {
+ console.log(
+ 'keyserver auth returned a different user info than identity login',
+ );
+ } else {
+ const newUserInfo = {
+ ...state,
+ avatar: actionUserInfo.avatar,
+ settings: actionUserInfo.settings,
+ };
+ if (!_isEqual(newUserInfo)(state)) {
+ return newUserInfo;
+ }
+ }
+ }
+ } else if (
action.type === logInActionTypes.success ||
action.type === siweAuthActionTypes.success ||
action.type === keyserverRegisterActionTypes.success ||

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 4:28 AM (18 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2568317
Default Alt Text
D11140.diff (1 KB)

Event Timeline