Page MenuHomePhabricator

D10211.id.diff
No OneTemporary

D10211.id.diff

diff --git a/keyserver/src/shared/state-sync/threads-state-sync-spec.js b/keyserver/src/shared/state-sync/threads-state-sync-spec.js
--- a/keyserver/src/shared/state-sync/threads-state-sync-spec.js
+++ b/keyserver/src/shared/state-sync/threads-state-sync-spec.js
@@ -1,11 +1,13 @@
// @flow
+import { rawThreadInfoValidator } from 'lib/permissions/minimally-encoded-thread-permissions-validators.js';
import { threadsStateSyncSpec as libSpec } from 'lib/shared/state-sync/threads-state-sync-spec.js';
import type { ClientThreadInconsistencyReportCreationRequest } from 'lib/types/report-types.js';
import {
type LegacyRawThreadInfos,
type LegacyRawThreadInfo,
- legacyRawThreadInfoValidator,
+ type RawThreadInfo,
+ type RawThreadInfos,
} from 'lib/types/thread-types.js';
import { hash, combineUnorderedHashes, values } from 'lib/utils/objects.js';
@@ -40,10 +42,10 @@
return result.threadInfos;
}
-function getServerInfosHash(infos: LegacyRawThreadInfos) {
+function getServerInfosHash(infos: RawThreadInfos) {
return combineUnorderedHashes(values(infos).map(getServerInfoHash));
}
-function getServerInfoHash(info: LegacyRawThreadInfo) {
- return hash(validateOutput(null, legacyRawThreadInfoValidator, info));
+function getServerInfoHash(info: RawThreadInfo) {
+ return hash(validateOutput(null, rawThreadInfoValidator, info));
}
diff --git a/lib/permissions/minimally-encoded-thread-permissions-validators.js b/lib/permissions/minimally-encoded-thread-permissions-validators.js
--- a/lib/permissions/minimally-encoded-thread-permissions-validators.js
+++ b/lib/permissions/minimally-encoded-thread-permissions-validators.js
@@ -1,5 +1,6 @@
// @flow
-import t, { type TInterface } from 'tcomb';
+
+import t, { type TInterface, type TUnion } from 'tcomb';
import {
tHexEncodedPermissionsBitmask,
@@ -21,6 +22,7 @@
threadCurrentUserInfoValidator,
legacyThreadInfoValidator,
} from '../types/thread-types.js';
+import type { RawThreadInfo } from '../types/thread-types.js';
import { tBool, tID, tShape } from '../utils/validation-utils.js';
const minimallyEncodedRoleInfoValidator: TInterface<MinimallyEncodedRoleInfo> =
@@ -75,6 +77,11 @@
currentUser: minimallyEncodedThreadCurrentUserInfoValidator,
});
+export const rawThreadInfoValidator: TUnion<RawThreadInfo> = t.union([
+ legacyRawThreadInfoValidator,
+ minimallyEncodedRawThreadInfoValidator,
+]);
+
export {
minimallyEncodedRoleInfoValidator,
minimallyEncodedThreadCurrentUserInfoValidator,
diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js
--- a/lib/types/thread-types.js
+++ b/lib/types/thread-types.js
@@ -145,6 +145,9 @@
});
export type RawThreadInfo = LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo;
+export type RawThreadInfos = {
+ +[id: string]: RawThreadInfo,
+};
export type LegacyThreadInfo = {
+id: string,

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 5:59 AM (10 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2704022
Default Alt Text
D10211.id.diff (2 KB)

Event Timeline