Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3531101
D10211.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10211.id.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D10211: [lib] Introduce `rawThreadInfoValidator` and consume in `threads-state-sync-spec`
Attached
Detach File
Event Timeline
Log In to Comment