Page MenuHomePhabricator

D9060.id30690.diff
No OneTemporary

D9060.id30690.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
@@ -605,7 +605,7 @@
_persist: null,
commServicesAccessToken: null,
inviteLinksStore: inviteLinksStorePromise,
- lastCommunicatedPlatformDetails: {},
+ lastCommunicatedPlatformDetails: null,
keyserverStore: keyserverStorePromise,
});
const validatedInitialReduxState = validateOutput(
diff --git a/lib/reducers/last-communicated-platform-details-reducer.js b/lib/reducers/last-communicated-platform-details-reducer.js
--- a/lib/reducers/last-communicated-platform-details-reducer.js
+++ b/lib/reducers/last-communicated-platform-details-reducer.js
@@ -6,30 +6,23 @@
logInActionTypes,
registerActionTypes,
} from '../actions/user-actions.js';
-import type { LastCommunicatedPlatformDetails } from '../types/device-types';
+import type { PlatformDetails } from '../types/device-types';
import type { BaseAction } from '../types/redux-types';
import { getConfig } from '../utils/config.js';
export default function reduceLastCommunicatedPlatformDetails(
- state: LastCommunicatedPlatformDetails,
+ state: ?PlatformDetails,
action: BaseAction,
- currentURLPrefix: string,
-): LastCommunicatedPlatformDetails {
+): ?PlatformDetails {
if (
action.type === logInActionTypes.success ||
action.type === siweAuthActionTypes.success ||
action.type === registerActionTypes.success
) {
- return {
- ...state,
- [currentURLPrefix]: getConfig().platformDetails,
- };
+ return getConfig().platformDetails;
}
if (action.type === updateLastCommunicatedPlatformDetailsActionType) {
- return {
- ...state,
- ...action.payload,
- };
+ return action.payload;
}
return state;
}
diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js
--- a/lib/reducers/master-reducer.js
+++ b/lib/reducers/master-reducer.js
@@ -148,7 +148,6 @@
lastCommunicatedPlatformDetails: reduceLastCommunicatedPlatformDetails(
state.lastCommunicatedPlatformDetails,
action,
- state.keyserverStore.keyserverInfos[ashoatKeyserverID].urlPrefix,
),
keyserverStore,
},
diff --git a/lib/selectors/server-calls.js b/lib/selectors/server-calls.js
--- a/lib/selectors/server-calls.js
+++ b/lib/selectors/server-calls.js
@@ -8,7 +8,7 @@
urlPrefixSelector,
connectionSelector,
} from './keyserver-selectors.js';
-import type { LastCommunicatedPlatformDetails } from '../types/device-types.js';
+import type { PlatformDetails } from '../types/device-types.js';
import type { AppState } from '../types/redux-types.js';
import type {
ConnectionInfo,
@@ -22,7 +22,7 @@
+sessionID: ?string,
+currentUserInfo: ?CurrentUserInfo,
+connectionStatus: ?ConnectionStatus,
- +lastCommunicatedPlatformDetails: LastCommunicatedPlatformDetails,
+ +lastCommunicatedPlatformDetails: ?PlatformDetails,
};
const serverCallStateSelector: (state: AppState) => ServerCallState =
@@ -39,7 +39,7 @@
sessionID: ?string,
currentUserInfo: ?CurrentUserInfo,
connectionInfo: ?ConnectionInfo,
- lastCommunicatedPlatformDetails: LastCommunicatedPlatformDetails,
+ lastCommunicatedPlatformDetails: ?PlatformDetails,
) => ({
cookie,
urlPrefix,
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
@@ -582,7 +582,7 @@
if (shouldSendInitialPlatformDetails) {
this.props.dispatch({
type: updateLastCommunicatedPlatformDetailsActionType,
- payload: { [this.props.urlPrefix]: getConfig().platformDetails },
+ payload: getConfig().platformDetails,
});
}
diff --git a/lib/types/device-types.js b/lib/types/device-types.js
--- a/lib/types/device-types.js
+++ b/lib/types/device-types.js
@@ -44,7 +44,3 @@
export type VersionResponse = {
+codeVersion: number,
};
-
-export type LastCommunicatedPlatformDetails = {
- +[urlPrefix: string]: PlatformDetails,
-};
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
@@ -17,10 +17,7 @@
UpdateUserAvatarResponse,
} from './avatar-types.js';
import type { CryptoStore } from './crypto-types.js';
-import type {
- VersionResponse,
- LastCommunicatedPlatformDetails,
-} from './device-types.js';
+import type { VersionResponse, PlatformDetails } from './device-types.js';
import type { ClientDBDraftInfo, DraftStore } from './draft-types.js';
import type { EnabledApps, SupportedApps } from './enabled-apps.js';
import type {
@@ -138,7 +135,7 @@
+deviceToken: ?string,
+commServicesAccessToken: ?string,
+inviteLinksStore: InviteLinksStore,
- +lastCommunicatedPlatformDetails: LastCommunicatedPlatformDetails,
+ +lastCommunicatedPlatformDetails: ?PlatformDetails,
+keyserverStore: KeyserverStore,
...
};
@@ -1160,7 +1157,7 @@
}
| {
+type: 'UPDATE_LAST_COMMUNICATED_PLATFORM_DETAILS',
- +payload: LastCommunicatedPlatformDetails,
+ +payload: PlatformDetails,
}
| { +type: 'RESET_USER_STATE', +payload?: void }
| {
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
@@ -19,7 +19,7 @@
type LogInStartingPayload,
type LogInResult,
} from '../types/account-types.js';
-import type { LastCommunicatedPlatformDetails } from '../types/device-types.js';
+import type { PlatformDetails } from '../types/device-types.js';
import type { Endpoint, SocketAPIHandler } from '../types/endpoints.js';
import type { LoadingOptions, LoadingInfo } from '../types/loading-types.js';
import type {
@@ -373,7 +373,7 @@
+sessionID: ?string,
+currentUserInfo: ?CurrentUserInfo,
+connectionStatus: ConnectionStatus,
- +lastCommunicatedPlatformDetails: LastCommunicatedPlatformDetails,
+ +lastCommunicatedPlatformDetails: ?PlatformDetails,
};
// All server calls needs to include some information from the Redux state
@@ -403,7 +403,7 @@
sessionID: ?string,
currentUserInfo: ?CurrentUserInfo,
connectionStatus: ConnectionStatus,
- lastCommunicatedPlatformDetails: LastCommunicatedPlatformDetails,
+ lastCommunicatedPlatformDetails: ?PlatformDetails,
) => {
const boundCallServerEndpoint = bindCookieAndUtilsIntoCallServerEndpoint({
dispatch,
diff --git a/lib/utils/call-server-endpoint.js b/lib/utils/call-server-endpoint.js
--- a/lib/utils/call-server-endpoint.js
+++ b/lib/utils/call-server-endpoint.js
@@ -14,10 +14,7 @@
import { updateLastCommunicatedPlatformDetailsActionType } from '../actions/device-actions.js';
import { callServerEndpointTimeout } from '../shared/timeouts.js';
import type { Shape } from '../types/core.js';
-import type {
- PlatformDetails,
- LastCommunicatedPlatformDetails,
-} from '../types/device-types.js';
+import type { PlatformDetails } from '../types/device-types.js';
import {
type Endpoint,
type SocketAPIHandler,
@@ -95,7 +92,7 @@
urlPrefix: string,
sessionID: ?string,
connectionStatus: ConnectionStatus,
- lastCommunicatedPlatformDetails: ?LastCommunicatedPlatformDetails,
+ lastCommunicatedPlatformDetails: ?PlatformDetails,
socketAPIHandler: ?SocketAPIHandler,
endpoint: Endpoint,
input: { [key: string]: mixed },
@@ -109,9 +106,7 @@
const shouldSendPlatformDetails =
lastCommunicatedPlatformDetails &&
- !_isEqual(lastCommunicatedPlatformDetails[urlPrefix])(
- getConfig().platformDetails,
- );
+ !_isEqual(lastCommunicatedPlatformDetails)(getConfig().platformDetails);
if (
endpointIsSocketPreferred(endpoint) &&
@@ -227,9 +222,7 @@
if (!error && shouldSendPlatformDetails) {
dispatch({
type: updateLastCommunicatedPlatformDetailsActionType,
- payload: {
- [urlPrefix]: getConfig().platformDetails,
- },
+ payload: getConfig().platformDetails,
});
}
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
@@ -120,7 +120,7 @@
inviteLinksStore: {
links: {},
},
- lastCommunicatedPlatformDetails: {},
+ lastCommunicatedPlatformDetails: null,
keyserverStore: {
keyserverInfos: {
[ashoatKeyserverID]: {
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
@@ -3,7 +3,7 @@
import type { Orientations } from 'react-native-orientation-locker';
import type { PersistState } from 'redux-persist/es/types.js';
-import type { LastCommunicatedPlatformDetails } from 'lib/types/device-types.js';
+import type { PlatformDetails } from 'lib/types/device-types.js';
import type { DraftStore } from 'lib/types/draft-types.js';
import type { EnabledApps } from 'lib/types/enabled-apps.js';
import type { EntryStore, CalendarQuery } from 'lib/types/entry-types.js';
@@ -56,6 +56,6 @@
+userPolicies: UserPolicies,
+commServicesAccessToken: ?string,
+inviteLinksStore: InviteLinksStore,
- +lastCommunicatedPlatformDetails: LastCommunicatedPlatformDetails,
+ +lastCommunicatedPlatformDetails: ?PlatformDetails,
+keyserverStore: KeyserverStore,
};
diff --git a/native/socket.react.js b/native/socket.react.js
--- a/native/socket.react.js
+++ b/native/socket.react.js
@@ -100,7 +100,7 @@
}, [active, navContext]);
const lastCommunicatedPlatformDetails = useSelector(
- state => state.lastCommunicatedPlatformDetails[urlPrefix],
+ state => state.lastCommunicatedPlatformDetails,
);
const dispatch = useDispatch();
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
@@ -18,7 +18,7 @@
OLMIdentityKeys,
PickledOLMAccount,
} from 'lib/types/crypto-types.js';
-import type { LastCommunicatedPlatformDetails } from 'lib/types/device-types.js';
+import type { PlatformDetails } from 'lib/types/device-types.js';
import type { DraftStore } from 'lib/types/draft-types.js';
import type { EnabledApps } from 'lib/types/enabled-apps.js';
import type { EntryStore, CalendarQuery } from 'lib/types/entry-types.js';
@@ -95,7 +95,7 @@
+_persist: ?PersistState,
+commServicesAccessToken: ?string,
+inviteLinksStore: InviteLinksStore,
- +lastCommunicatedPlatformDetails: LastCommunicatedPlatformDetails,
+ +lastCommunicatedPlatformDetails: ?PlatformDetails,
+keyserverStore: KeyserverStore,
};
diff --git a/web/socket.react.js b/web/socket.react.js
--- a/web/socket.react.js
+++ b/web/socket.react.js
@@ -65,7 +65,7 @@
const callLogOut = useServerCall(logOut);
const lastCommunicatedPlatformDetails = useSelector(
- state => state.lastCommunicatedPlatformDetails[urlPrefix],
+ state => state.lastCommunicatedPlatformDetails,
);
return (

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 5, 6:32 PM (22 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2245393
Default Alt Text
D9060.id30690.diff (10 KB)

Event Timeline