Page MenuHomePhabricator

D4990.id16120.diff
No OneTemporary

D4990.id16120.diff

diff --git a/lib/utils/validation-utils.js b/lib/utils/validation-utils.js
--- a/lib/utils/validation-utils.js
+++ b/lib/utils/validation-utils.js
@@ -1,6 +1,6 @@
// @flow
-import t from 'tcomb';
+import t, { TUnion } from 'tcomb';
import type {
TStructProps,
TIrreducible,
@@ -65,6 +65,22 @@
const tOldValidUsername: TRegex = tRegex(oldValidUsernameRegex);
const tID: TRefinement<string> = t.refinement(t.String, (id: string) => !!id);
+const tMediaMessagePhoto: TInterface = tShape({
+ type: t.refinement(t.String, s => s === 'photo'),
+ uploadID: t.String,
+});
+
+const tMediaMessageVideo: TInterface = tShape({
+ type: t.refinement(t.String, s => s === 'video'),
+ uploadID: t.String,
+ thumbnailUploadID: t.String,
+});
+
+const tMediaMessageMedia: TUnion<TInterface> = t.union([
+ tMediaMessagePhoto,
+ tMediaMessageVideo,
+]);
+
export {
tBool,
tString,
@@ -82,4 +98,7 @@
tEmail,
tOldValidUsername,
tID,
+ tMediaMessagePhoto,
+ tMediaMessageVideo,
+ tMediaMessageMedia,
};

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 11:52 PM (18 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2581726
Default Alt Text
D4990.id16120.diff (1023 B)

Event Timeline