Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3361319
D11229.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
10 KB
Referenced Files
None
Subscribers
None
D11229.diff
View Options
diff --git a/lib/reducers/data-loaded-reducer.js b/lib/reducers/data-loaded-reducer.js
--- a/lib/reducers/data-loaded-reducer.js
+++ b/lib/reducers/data-loaded-reducer.js
@@ -9,7 +9,7 @@
import { setNewSessionActionType } from '../keyserver-conn/keyserver-conn-types.js';
import type { BaseAction } from '../types/redux-types.js';
import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
-import { usingCommServicesAccessToken } from '../utils/services-utils.js';
+import { relyingOnAuthoritativeKeyserver } from '../utils/services-utils.js';
export default function reduceDataLoaded(
state: boolean,
@@ -21,9 +21,9 @@
return true;
} else if (
action.type === setNewSessionActionType &&
- action.payload.sessionChange.currentUserInfo &&
- action.payload.sessionChange.currentUserInfo.anonymous &&
- !usingCommServicesAccessToken
+ action.payload.sessionChange.cookieInvalidated &&
+ action.payload.keyserverID === authoritativeKeyserverID() &&
+ relyingOnAuthoritativeKeyserver
) {
return false;
} else if (action.type === logOutActionTypes.started) {
diff --git a/lib/reducers/enabled-apps-reducer.js b/lib/reducers/enabled-apps-reducer.js
--- a/lib/reducers/enabled-apps-reducer.js
+++ b/lib/reducers/enabled-apps-reducer.js
@@ -7,7 +7,8 @@
defaultWebEnabledApps,
} from '../types/enabled-apps.js';
import type { BaseAction } from '../types/redux-types.js';
-import { usingCommServicesAccessToken } from '../utils/services-utils.js';
+import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
+import { relyingOnAuthoritativeKeyserver } from '../utils/services-utils.js';
export const enableAppActionType = 'ENABLE_APP';
export const disableAppActionType = 'DISABLE_APP';
@@ -26,7 +27,8 @@
} else if (
action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated &&
- !usingCommServicesAccessToken
+ action.payload.keyserverID === authoritativeKeyserverID() &&
+ relyingOnAuthoritativeKeyserver
) {
return process.env.BROWSER ? defaultWebEnabledApps : defaultEnabledApps;
}
diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js
--- a/lib/reducers/entry-reducer.js
+++ b/lib/reducers/entry-reducer.js
@@ -60,9 +60,10 @@
type ClientUpdateInfo,
processUpdatesActionType,
} from '../types/update-types.js';
+import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
import { dateString } from '../utils/date-utils.js';
import { values } from '../utils/objects.js';
-import { usingCommServicesAccessToken } from '../utils/services-utils.js';
+import { relyingOnAuthoritativeKeyserver } from '../utils/services-utils.js';
function daysToEntriesFromEntryInfos(
entryInfos: $ReadOnlyArray<RawEntryInfo>,
@@ -211,7 +212,8 @@
let newLastUserInteractionCalendar = lastUserInteractionCalendar;
if (
action.payload.sessionChange.cookieInvalidated &&
- !usingCommServicesAccessToken
+ action.payload.keyserverID === authoritativeKeyserverID() &&
+ relyingOnAuthoritativeKeyserver
) {
newLastUserInteractionCalendar = 0;
}
diff --git a/lib/reducers/report-store-reducer.js b/lib/reducers/report-store-reducer.js
--- a/lib/reducers/report-store-reducer.js
+++ b/lib/reducers/report-store-reducer.js
@@ -27,9 +27,10 @@
defaultDevEnabledReports,
type ClientReportCreationRequest,
} from '../types/report-types.js';
+import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
import { isDev } from '../utils/dev-utils.js';
import { isReportEnabled } from '../utils/report-utils.js';
-import { usingCommServicesAccessToken } from '../utils/services-utils.js';
+import { relyingOnAuthoritativeKeyserver } from '../utils/services-utils.js';
export const updateReportsEnabledActionType = 'UPDATE_REPORTS_ENABLED';
@@ -90,7 +91,8 @@
} else if (
action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated &&
- !usingCommServicesAccessToken
+ action.payload.keyserverID === authoritativeKeyserverID() &&
+ relyingOnAuthoritativeKeyserver
) {
return {
reportStore: {
@@ -116,29 +118,30 @@
reportStoreOperations: [{ type: 'remove_all_reports' }],
};
} else if (
- (action.type === sendReportActionTypes.success ||
- action.type === sendReportsActionTypes.success) &&
- action.payload
+ action.type === sendReportActionTypes.success ||
+ action.type === sendReportsActionTypes.success
) {
const { payload } = action;
- const sentReports = state.queuedReports.filter(response =>
- payload.reports.includes(response),
- );
+ if (payload) {
+ const sentReports = state.queuedReports.filter(response =>
+ payload.reports.includes(response),
+ );
- const reportStoreOperations: $ReadOnlyArray<ReportStoreOperation> = [
- convertReportsToRemoveReportsOperation(sentReports),
- ...convertReportsToReplaceReportOps(newReports),
- ];
+ const reportStoreOperations: $ReadOnlyArray<ReportStoreOperation> = [
+ convertReportsToRemoveReportsOperation(sentReports),
+ ...convertReportsToReplaceReportOps(newReports),
+ ];
- const queuedReports = processReportStoreOperations(
- state.queuedReports,
- reportStoreOperations,
- );
+ const queuedReports = processReportStoreOperations(
+ state.queuedReports,
+ reportStoreOperations,
+ );
- return {
- reportStore: { ...state, queuedReports },
- reportStoreOperations,
- };
+ return {
+ reportStore: { ...state, queuedReports },
+ reportStoreOperations,
+ };
+ }
} else if (action.type === queueReportsActionType) {
const { reports } = action.payload;
const filteredReports = reports.filter(report =>
diff --git a/lib/reducers/services-access-token-reducer.js b/lib/reducers/services-access-token-reducer.js
--- a/lib/reducers/services-access-token-reducer.js
+++ b/lib/reducers/services-access-token-reducer.js
@@ -6,7 +6,8 @@
} from '../actions/user-actions.js';
import { setNewSessionActionType } from '../keyserver-conn/keyserver-conn-types.js';
import type { BaseAction } from '../types/redux-types.js';
-import { usingCommServicesAccessToken } from '../utils/services-utils.js';
+import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
+import { relyingOnAuthoritativeKeyserver } from '../utils/services-utils.js';
export default function reduceServicesAccessToken(
state: ?string,
@@ -16,9 +17,9 @@
return action.payload;
} else if (
action.type === setNewSessionActionType &&
- action.payload.sessionChange.currentUserInfo &&
- action.payload.sessionChange.currentUserInfo.anonymous &&
- !usingCommServicesAccessToken
+ action.payload.sessionChange.cookieInvalidated &&
+ action.payload.keyserverID === authoritativeKeyserverID() &&
+ relyingOnAuthoritativeKeyserver
) {
return null;
} else if (action.type === logOutActionTypes.started) {
diff --git a/lib/reducers/theme-reducer.js b/lib/reducers/theme-reducer.js
--- a/lib/reducers/theme-reducer.js
+++ b/lib/reducers/theme-reducer.js
@@ -12,7 +12,8 @@
defaultGlobalThemeInfo,
type GlobalThemeInfo,
} from '../types/theme-types.js';
-import { usingCommServicesAccessToken } from '../utils/services-utils.js';
+import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
+import { relyingOnAuthoritativeKeyserver } from '../utils/services-utils.js';
export default function reduceGlobalThemeInfo(
state: GlobalThemeInfo,
@@ -26,9 +27,9 @@
return defaultGlobalThemeInfo;
} else if (
action.type === setNewSessionActionType &&
- action.payload.sessionChange.currentUserInfo &&
- action.payload.sessionChange.currentUserInfo.anonymous &&
- !usingCommServicesAccessToken
+ action.payload.sessionChange.cookieInvalidated &&
+ action.payload.keyserverID === authoritativeKeyserverID() &&
+ relyingOnAuthoritativeKeyserver
) {
return defaultGlobalThemeInfo;
} else if (action.type === updateThemeInfoActionType) {
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
@@ -49,7 +49,7 @@
import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
import { getMessageForException } from '../utils/errors.js';
import { assertObjectsAreEqual } from '../utils/objects.js';
-import { usingCommServicesAccessToken } from '../utils/services-utils.js';
+import { relyingOnAuthoritativeKeyserver } from '../utils/services-utils.js';
function reduceCurrentUserInfo(
state: ?CurrentUserInfo,
@@ -97,7 +97,8 @@
} else if (
action.type === setNewSessionActionType &&
action.payload.sessionChange.currentUserInfo &&
- action.payload.keyserverID === authoritativeKeyserverID()
+ action.payload.keyserverID === authoritativeKeyserverID() &&
+ relyingOnAuthoritativeKeyserver
) {
const { sessionChange } = action.payload;
if (!_isEqual(sessionChange.currentUserInfo)(state)) {
@@ -244,7 +245,8 @@
} else if (
action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated &&
- !usingCommServicesAccessToken
+ action.payload.keyserverID === authoritativeKeyserverID() &&
+ relyingOnAuthoritativeKeyserver
) {
const userStoreOps: $ReadOnlyArray<UserStoreOperation> = [
{ type: 'remove_all_users' },
diff --git a/web/redux/crypto-store-reducer.js b/web/redux/crypto-store-reducer.js
--- a/web/redux/crypto-store-reducer.js
+++ b/web/redux/crypto-store-reducer.js
@@ -2,9 +2,10 @@
import { setNewSessionActionType } from 'lib/keyserver-conn/keyserver-conn-types.js';
import type { CryptoStore } from 'lib/types/crypto-types.js';
-import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js';
+import { relyingOnAuthoritativeKeyserver } from 'lib/utils/services-utils.js';
import type { Action } from './redux-setup.js';
+import { authoritativeKeyserverID } from '../authoritative-keyserver.js';
const setCryptoStore = 'SET_CRYPTO_STORE';
@@ -14,7 +15,8 @@
} else if (
action.type === setNewSessionActionType &&
action.payload.sessionChange.cookieInvalidated &&
- !usingCommServicesAccessToken
+ action.payload.keyserverID === authoritativeKeyserverID &&
+ relyingOnAuthoritativeKeyserver
) {
return null;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 4:33 PM (21 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580436
Default Alt Text
D11229.diff (10 KB)
Attached To
Mode
D11229: [lib][web] Update condition for Redux state reset in SET_NEW_SESSION reducers
Attached
Detach File
Event Timeline
Log In to Comment