Page MenuHomePhabricator

D11271.id37949.diff
No OneTemporary

D11271.id37949.diff

diff --git a/lib/selectors/socket-selectors.js b/lib/selectors/socket-selectors.js
--- a/lib/selectors/socket-selectors.js
+++ b/lib/selectors/socket-selectors.js
@@ -156,6 +156,9 @@
// the hashes in the background. In this case we return true
// to skip this state check. Future state checks (after the hash
// calculation complete) will be handled normally.
+ // Another case when this is null is when we are handling state
+ // sync with a non-authoritative keyserver. We don't want to sync
+ // user store and current user info with such keyservers.
if (!hashValue) {
hashResults[key] = true;
} else {
diff --git a/lib/shared/state-sync/current-user-state-sync-spec.js b/lib/shared/state-sync/current-user-state-sync-spec.js
--- a/lib/shared/state-sync/current-user-state-sync-spec.js
+++ b/lib/shared/state-sync/current-user-state-sync-spec.js
@@ -3,8 +3,10 @@
import { createSelector } from 'reselect';
import type { StateSyncSpec, BoundStateSyncSpec } from './state-sync-spec.js';
+import type { CalendarQuery } from '../../types/entry-types.js';
import type { AppState } from '../../types/redux-types';
import { type CurrentUserInfo } from '../../types/user-types.js';
+import { authoritativeKeyserverID } from '../../utils/authoritative-keyserver.js';
import { hash } from '../../utils/objects.js';
const selector: (
@@ -15,7 +17,12 @@
(currentUserInfo: ?CurrentUserInfo) => ({
...currentUserStateSyncSpec,
getInfoHash: () => hash(currentUserInfo),
- getAllInfosHash: () => hash(currentUserInfo),
+ getAllInfosHash: (query: CalendarQuery, keyserverID: string) => {
+ if (keyserverID !== authoritativeKeyserverID()) {
+ return null;
+ }
+ return hash(currentUserInfo);
+ },
getIDs: () => ([]: string[]),
}),
);
diff --git a/lib/shared/state-sync/users-state-sync-spec.js b/lib/shared/state-sync/users-state-sync-spec.js
--- a/lib/shared/state-sync/users-state-sync-spec.js
+++ b/lib/shared/state-sync/users-state-sync-spec.js
@@ -4,6 +4,7 @@
import { createSelector } from 'reselect';
import type { StateSyncSpec, BoundStateSyncSpec } from './state-sync-spec.js';
+import type { CalendarQuery } from '../../types/entry-types.js';
import type { AppState } from '../../types/redux-types';
import {
type ClientUserInconsistencyReportCreationRequest,
@@ -12,6 +13,7 @@
import type { ProcessServerRequestAction } from '../../types/request-types.js';
import { type UserInfo, type UserInfos } from '../../types/user-types.js';
import { actionLogger } from '../../utils/action-logger.js';
+import { authoritativeKeyserverID } from '../../utils/authoritative-keyserver.js';
import { getConfig } from '../../utils/config.js';
import { combineUnorderedHashes, hash } from '../../utils/objects.js';
import { generateReportID } from '../../utils/report-utils.js';
@@ -28,9 +30,18 @@
(userInfos: UserInfos) => ({
...usersStateSyncSpec,
getInfoHash: (id: string) => hash(userInfos[id]),
- getAllInfosHash: () =>
- combineUnorderedHashes(Object.values(userInfos).map(hash)),
- getIDs: () => Object.keys(userInfos),
+ getAllInfosHash: (query: CalendarQuery, keyserverID: string) => {
+ if (keyserverID !== authoritativeKeyserverID()) {
+ return null;
+ }
+ return combineUnorderedHashes(Object.values(userInfos).map(hash));
+ },
+ getIDs: (query: CalendarQuery, keyserverID: string) => {
+ if (keyserverID !== authoritativeKeyserverID()) {
+ return null;
+ }
+ return Object.keys(userInfos);
+ },
}),
);

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 5:02 AM (20 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2859934
Default Alt Text
D11271.id37949.diff (3 KB)

Event Timeline