Page MenuHomePhabricator

D11642.id39202.diff
No OneTemporary

D11642.id39202.diff

diff --git a/lib/types/messages/update-relationship.js b/lib/types/messages/update-relationship.js
--- a/lib/types/messages/update-relationship.js
+++ b/lib/types/messages/update-relationship.js
@@ -1,8 +1,8 @@
// @flow
-import t, { type TInterface } from 'tcomb';
+import t, { type TInterface, type TUnion } from 'tcomb';
-import { tID, tNumber, tShape } from '../../utils/validation-utils.js';
+import { tID, tNumber, tShape, tString } from '../../utils/validation-utils.js';
import { messageTypes } from '../message-types-enum.js';
import type { RelativeUserInfo } from '../user-types.js';
@@ -41,21 +41,36 @@
id: string,
};
-export const rawUpdateRelationshipMessageInfoValidator: TInterface<RawUpdateRelationshipMessageInfo> =
+export const rawUpdateTraditionalRelationshipMessageInfoValidator: TInterface<RawUpdateRelationshipMessageInfo> =
tShape<RawUpdateRelationshipMessageInfo>({
+ id: tID,
type: tNumber(messageTypes.UPDATE_RELATIONSHIP),
threadID: tID,
creatorID: t.String,
targetID: t.String,
time: t.Number,
- operation: t.enums.of([
- 'request_sent',
- 'request_accepted',
- 'farcaster_mutual',
- ]),
+ operation: t.enums.of(['request_sent', 'request_accepted']),
+ });
+
+export const rawUpdateFarcasterRelationshipMessageInfoValidator: TInterface<RawUpdateRelationshipMessageInfo> =
+ tShape<RawUpdateRelationshipMessageInfo>({
id: tID,
+ type: tNumber(messageTypes.UPDATE_RELATIONSHIP),
+ threadID: tID,
+ creatorID: t.String,
+ creatorFID: t.String,
+ targetID: t.String,
+ targetFID: t.String,
+ time: t.Number,
+ operation: tString('farcaster_mutual'),
});
+export const rawUpdateRelationshipMessageInfoValidator: TUnion<RawUpdateRelationshipMessageInfo> =
+ t.union([
+ rawUpdateTraditionalRelationshipMessageInfoValidator,
+ rawUpdateFarcasterRelationshipMessageInfoValidator,
+ ]);
+
export type UpdateRelationshipMessageInfo = {
+type: 22,
+id: string,

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 12:32 AM (21 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595265
Default Alt Text
D11642.id39202.diff (1 KB)

Event Timeline