Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3396604
D5517.id18020.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Referenced Files
None
Subscribers
None
D5517.id18020.diff
View Options
diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js
--- a/keyserver/src/responders/user-responders.js
+++ b/keyserver/src/responders/user-responders.js
@@ -19,7 +19,7 @@
import {
userSettingsTypes,
notificationTypeValues,
- loginActionSources,
+ logInActionSources,
} from 'lib/types/account-types';
import { defaultNumberPerThread } from 'lib/types/message-types';
import type {
@@ -190,7 +190,7 @@
calendarQuery: t.maybe(entryQueryInputValidator),
deviceTokenUpdateRequest: t.maybe(deviceTokenUpdateRequestInputValidator),
platformDetails: tPlatformDetails,
- source: t.maybe(t.enums.of(values(loginActionSources))),
+ source: t.maybe(t.enums.of(values(logInActionSources))),
});
async function logInResponder(
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
@@ -115,10 +115,12 @@
callServerEndpoint: CallServerEndpoint,
): ((logInInfo: LogInInfo) => Promise<LogInResult>) => async logInInfo => {
const watchedIDs = threadWatcher.getWatchedIDs();
+ const { logInActionSource, ...restLogInInfo } = logInInfo;
const response = await callServerEndpoint(
'log_in',
{
- ...logInInfo,
+ ...restLogInInfo,
+ source: logInActionSource,
watchedIDs,
platformDetails: getConfig().platformDetails,
},
@@ -143,7 +145,7 @@
},
userInfos,
updatesCurrentAsOf: response.serverTime,
- source: logInInfo.source,
+ logInActionSource: logInInfo.logInActionSource,
};
};
diff --git a/lib/shared/account-utils.js b/lib/shared/account-utils.js
--- a/lib/shared/account-utils.js
+++ b/lib/shared/account-utils.js
@@ -1,7 +1,7 @@
// @flow
import {
- loginActionSources,
+ logInActionSources,
type LogInActionSource,
} from '../types/account-types';
import type { AppState } from '../types/redux-types';
@@ -59,11 +59,12 @@
function invalidSessionRecovery(
currentReduxState: AppState,
actionCurrentUserInfo: CurrentUserInfo,
- source: ?LogInActionSource,
+ logInActionSource: ?LogInActionSource,
): boolean {
if (
- source !== loginActionSources.cookieInvalidationResolutionAttempt &&
- source !== loginActionSources.socketAuthErrorResolutionAttempt
+ logInActionSource !==
+ logInActionSources.cookieInvalidationResolutionAttempt &&
+ logInActionSource !== logInActionSources.socketAuthErrorResolutionAttempt
) {
return false;
}
diff --git a/lib/socket/socket.react.js b/lib/socket/socket.react.js
--- a/lib/socket/socket.react.js
+++ b/lib/socket/socket.react.js
@@ -13,7 +13,7 @@
clientRequestVisualTimeout,
clientRequestSocketTimeout,
} from '../shared/timeouts';
-import { loginActionSources, type LogOutResult } from '../types/account-types';
+import { logInActionSources, type LogOutResult } from '../types/account-types';
import type { CalendarQuery } from '../types/entry-types';
import type { Dispatch } from '../types/redux-types';
import {
@@ -451,7 +451,7 @@
this.props.dispatch,
cookie,
this.props.urlPrefix,
- loginActionSources.socketAuthErrorResolutionAttempt,
+ logInActionSources.socketAuthErrorResolutionAttempt,
);
if (!recoverySessionChange && sessionChange) {
@@ -468,7 +468,8 @@
},
preRequestUserState: this.initializedWithUserState,
error: null,
- source: loginActionSources.socketAuthErrorResolutionAttempt,
+ logInActionSource:
+ logInActionSources.socketAuthErrorResolutionAttempt,
},
});
} else if (!recoverySessionChange) {
@@ -589,7 +590,7 @@
sessionChange: { cookieInvalidated: false, sessionID },
preRequestUserState: this.initializedWithUserState,
error: null,
- source: undefined,
+ logInActionSource: undefined,
},
});
}
diff --git a/lib/types/account-types.js b/lib/types/account-types.js
--- a/lib/types/account-types.js
+++ b/lib/types/account-types.js
@@ -74,7 +74,7 @@
+password: string,
};
-export const loginActionSources = Object.freeze({
+export const logInActionSources = Object.freeze({
cookieInvalidationResolutionAttempt: 'COOKIE_INVALIDATION_RESOLUTION_ATTEMPT',
appStartCookieLoggedInButInvalidRedux:
'APP_START_COOKIE_LOGGED_IN_BUT_INVALID_REDUX',
@@ -87,11 +87,11 @@
logInFromNativeForm: 'LOG_IN_FROM_NATIVE_FORM',
});
-export type LogInActionSource = $Values<typeof loginActionSources>;
+export type LogInActionSource = $Values<typeof logInActionSources>;
export type LogInStartingPayload = {
+calendarQuery: CalendarQuery,
- +source?: LogInActionSource,
+ +logInActionSource?: LogInActionSource,
};
export type LogInExtraInfo = {
@@ -103,7 +103,7 @@
...LogInExtraInfo,
+username: string,
+password: string,
- +source: LogInActionSource,
+ +logInActionSource: LogInActionSource,
};
export type LogInRequest = {
@@ -137,7 +137,7 @@
+userInfos: $ReadOnlyArray<UserInfo>,
+calendarResult: CalendarResult,
+updatesCurrentAsOf: number,
- +source: LogInActionSource,
+ +logInActionSource: LogInActionSource,
};
export type UpdatePasswordRequest = {
diff --git a/lib/types/session-types.js b/lib/types/session-types.js
--- a/lib/types/session-types.js
+++ b/lib/types/session-types.js
@@ -88,7 +88,7 @@
sessionChange: ClientSessionChange,
preRequestUserState: ?PreRequestUserState,
error: ?string,
- source: ?LogInActionSource,
+ logInActionSource: ?LogInActionSource,
};
export type SessionState = {
diff --git a/lib/utils/action-utils.js b/lib/utils/action-utils.js
--- a/lib/utils/action-utils.js
+++ b/lib/utils/action-utils.js
@@ -7,7 +7,7 @@
import { serverCallStateSelector } from '../selectors/server-calls';
import {
- loginActionSources,
+ logInActionSources,
type LogInActionSource,
type LogInStartingPayload,
type LogInResult,
@@ -161,11 +161,11 @@
sessionChange: ClientSessionChange,
preRequestUserState: ?PreRequestUserState,
error: ?string,
- source: ?LogInActionSource,
+ logInActionSource: ?LogInActionSource,
) {
dispatch({
type: setNewSessionActionType,
- payload: { sessionChange, preRequestUserState, error, source },
+ payload: { sessionChange, preRequestUserState, error, logInActionSource },
});
}
@@ -178,7 +178,7 @@
dispatch: Dispatch,
cookie: ?string,
urlPrefix: string,
- source: LogInActionSource,
+ logInActionSource: LogInActionSource,
): Promise<?ClientSessionChange> {
const resolveInvalidatedCookie = getConfig().resolveInvalidatedCookie;
if (!resolveInvalidatedCookie) {
@@ -196,7 +196,7 @@
error: ?string,
) => {
newSessionChange = sessionChange;
- setNewSession(dispatch, sessionChange, null, error, source);
+ setNewSession(dispatch, sessionChange, null, error, logInActionSource);
};
try {
const result = await callServerEndpoint(
@@ -232,14 +232,14 @@
promise: Promise<LogInResult>,
inputStartingPayload: LogInStartingPayload,
) => {
- const startingPayload = { ...inputStartingPayload, source };
+ const startingPayload = { ...inputStartingPayload, logInActionSource };
dispatch(wrapActionPromise(actionTypes, promise, null, startingPayload));
return new Promise(r => (callServerEndpointCallback = r));
};
await resolveInvalidatedCookie(
boundCallServerEndpoint,
dispatchRecoveryAttempt,
- source,
+ logInActionSource,
);
return newSessionChange;
}
@@ -294,7 +294,7 @@
dispatch,
newAnonymousCookie,
urlPrefix,
- loginActionSources.cookieInvalidationResolutionAttempt,
+ logInActionSources.cookieInvalidationResolutionAttempt,
);
currentlyWaitingForNewCookie = false;
diff --git a/lib/utils/config.js b/lib/utils/config.js
--- a/lib/utils/config.js
+++ b/lib/utils/config.js
@@ -11,7 +11,7 @@
+resolveInvalidatedCookie: ?(
callServerEndpoint: CallServerEndpoint,
dispatchRecoveryAttempt: DispatchRecoveryAttempt,
- source: LogInActionSource,
+ logInActionSource: LogInActionSource,
) => Promise<void>,
+setCookieOnRequest: boolean,
+setSessionIDOnRequest: boolean,
diff --git a/native/account/log-in-panel.react.js b/native/account/log-in-panel.react.js
--- a/native/account/log-in-panel.react.js
+++ b/native/account/log-in-panel.react.js
@@ -16,7 +16,7 @@
type LogInExtraInfo,
type LogInResult,
type LogInStartingPayload,
- loginActionSources,
+ logInActionSources,
} from 'lib/types/account-types';
import type { LoadingStatus } from 'lib/types/loading-types';
import {
@@ -243,7 +243,7 @@
...extraInfo,
username: this.usernameInputText,
password: this.passwordInputText,
- source: loginActionSources.logInFromNativeForm,
+ logInActionSource: logInActionSources.logInFromNativeForm,
});
this.props.setActiveAlert(false);
await setNativeCredentials({
diff --git a/native/account/logged-out-modal.react.js b/native/account/logged-out-modal.react.js
--- a/native/account/logged-out-modal.react.js
+++ b/native/account/logged-out-modal.react.js
@@ -19,7 +19,7 @@
import { useDispatch } from 'react-redux';
import { isLoggedIn } from 'lib/selectors/user-selectors';
-import { loginActionSources } from 'lib/types/account-types';
+import { logInActionSources } from 'lib/types/account-types';
import type { Dispatch } from 'lib/types/redux-types';
import { fetchNewCookieFromNativeCredentials } from 'lib/utils/action-utils';
@@ -286,8 +286,8 @@
}
if (!__DEV__) {
const actionSource = loggedIn
- ? loginActionSources.appStartReduxLoggedInButInvalidCookie
- : loginActionSources.appStartCookieLoggedInButInvalidRedux;
+ ? logInActionSources.appStartReduxLoggedInButInvalidCookie
+ : logInActionSources.appStartCookieLoggedInButInvalidRedux;
const sessionChange = await fetchNewCookieFromNativeCredentials(
dispatch,
cookie,
diff --git a/native/account/resolve-invalidated-cookie.js b/native/account/resolve-invalidated-cookie.js
--- a/native/account/resolve-invalidated-cookie.js
+++ b/native/account/resolve-invalidated-cookie.js
@@ -13,7 +13,7 @@
async function resolveInvalidatedCookie(
callServerEndpoint: CallServerEndpoint,
dispatchRecoveryAttempt: DispatchRecoveryAttempt,
- source: LogInActionSource,
+ logInActionSource: LogInActionSource,
) {
const keychainCredentials = await fetchNativeKeychainCredentials();
if (!keychainCredentials) {
@@ -29,7 +29,7 @@
logIn(callServerEndpoint)({
...keychainCredentials,
...extraInfo,
- source,
+ logInActionSource,
}),
{ calendarQuery },
);
diff --git a/native/data/sqlite-context-provider.js b/native/data/sqlite-context-provider.js
--- a/native/data/sqlite-context-provider.js
+++ b/native/data/sqlite-context-provider.js
@@ -7,7 +7,7 @@
import { setMessageStoreMessages } from 'lib/actions/message-actions.js';
import { setThreadStoreActionType } from 'lib/actions/thread-actions';
-import { loginActionSources } from 'lib/types/account-types';
+import { logInActionSources } from 'lib/types/account-types';
import { fetchNewCookieFromNativeCredentials } from 'lib/utils/action-utils';
import { getMessageForException } from 'lib/utils/errors';
import { convertClientDBThreadInfosToRawThreadInfos } from 'lib/utils/thread-ops-utils';
@@ -66,7 +66,7 @@
dispatch,
cookie,
urlPrefix,
- loginActionSources.sqliteLoadFailure,
+ logInActionSources.sqliteLoadFailure,
);
setStoreLoaded(true);
} catch (fetchCookieException) {
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
@@ -19,7 +19,7 @@
invalidSessionDowngrade,
invalidSessionRecovery,
} from 'lib/shared/account-utils';
-import { loginActionSources } from 'lib/types/account-types';
+import { logInActionSources } from 'lib/types/account-types';
import { defaultEnabledApps } from 'lib/types/enabled-apps';
import { defaultCalendarFilters } from 'lib/types/filter-types';
import type { Dispatch, BaseAction } from 'lib/types/redux-types';
@@ -158,13 +158,13 @@
invalidSessionRecovery(
state,
action.payload.sessionChange.currentUserInfo,
- action.payload.source,
+ action.payload.logInActionSource,
)) ||
(action.type === logInActionTypes.success &&
invalidSessionRecovery(
state,
action.payload.currentUserInfo,
- action.payload.source,
+ action.payload.logInActionSource,
))
) {
return state;
@@ -347,7 +347,7 @@
cookie: state.cookie,
},
error: null,
- source: loginActionSources.sqliteOpFailure,
+ logInActionSource: logInActionSources.sqliteOpFailure,
},
});
await persistor.flush();
diff --git a/web/account/log-in-form.react.js b/web/account/log-in-form.react.js
--- a/web/account/log-in-form.react.js
+++ b/web/account/log-in-form.react.js
@@ -13,7 +13,7 @@
import {
type LogInExtraInfo,
type LogInStartingPayload,
- loginActionSources,
+ logInActionSources,
} from 'lib/types/account-types';
import {
useDispatchActionPromise,
@@ -66,7 +66,7 @@
...extraInfo,
username,
password,
- source: loginActionSources.logInFromWebForm,
+ logInActionSource: logInActionSources.logInFromWebForm,
});
modalContext.popModal();
return result;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 1:38 PM (19 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2607339
Default Alt Text
D5517.id18020.diff (13 KB)
Attached To
Mode
D5517: rename `source` to `logInActionSource`
Attached
Detach File
Event Timeline
Log In to Comment