Page MenuHomePhabricator

D11871.diff
No OneTemporary

D11871.diff

diff --git a/lib/types/messages/change-role.js b/lib/types/messages/change-role.js
--- a/lib/types/messages/change-role.js
+++ b/lib/types/messages/change-role.js
@@ -16,10 +16,10 @@
+roleName?: string, // Older clients will not have this field
};
-export type RawChangeRoleMessageInfo = {
+export type RawChangeRoleMessageInfo = $ReadOnly<{
...ChangeRoleMessageData,
+id: string,
-};
+}>;
export const rawChangeRoleMessageInfoValidator: TInterface<RawChangeRoleMessageInfo> =
tShape<RawChangeRoleMessageInfo>({
diff --git a/lib/types/messages/edit.js b/lib/types/messages/edit.js
--- a/lib/types/messages/edit.js
+++ b/lib/types/messages/edit.js
@@ -15,10 +15,10 @@
+text: string,
};
-export type RawEditMessageInfo = {
+export type RawEditMessageInfo = $ReadOnly<{
...EditMessageData,
+id: string,
-};
+}>;
export const rawEditMessageInfoValidator: TInterface<RawEditMessageInfo> =
tShape<RawEditMessageInfo>({
diff --git a/lib/types/messages/media.js b/lib/types/messages/media.js
--- a/lib/types/messages/media.js
+++ b/lib/types/messages/media.js
@@ -16,15 +16,15 @@
+media: $ReadOnlyArray<Media>,
};
-export type MediaMessageData = {
+export type MediaMessageData = $ReadOnly<{
...MediaSharedBase,
+sidebarCreation?: boolean,
-};
+}>;
-export type RawMediaMessageInfo = {
+export type RawMediaMessageInfo = $ReadOnly<{
...MediaSharedBase,
+id?: string, // null if local copy without ID yet
-};
+}>;
export const rawMediaMessageInfoValidator: TInterface<RawMediaMessageInfo> =
tShape<RawMediaMessageInfo>({
diff --git a/lib/types/messages/reaction.js b/lib/types/messages/reaction.js
--- a/lib/types/messages/reaction.js
+++ b/lib/types/messages/reaction.js
@@ -17,10 +17,10 @@
+action: 'add_reaction' | 'remove_reaction',
};
-export type RawReactionMessageInfo = {
+export type RawReactionMessageInfo = $ReadOnly<{
...ReactionMessageData,
- id?: string, // null if local copy without ID yet
-};
+ +id?: string, // null if local copy without ID yet
+}>;
export const rawReactionMessageInfoValidator: TInterface<RawReactionMessageInfo> =
tShape<RawReactionMessageInfo>({
diff --git a/lib/types/messages/toggle-pin.js b/lib/types/messages/toggle-pin.js
--- a/lib/types/messages/toggle-pin.js
+++ b/lib/types/messages/toggle-pin.js
@@ -16,10 +16,10 @@
+time: number,
};
-export type RawTogglePinMessageInfo = {
+export type RawTogglePinMessageInfo = $ReadOnly<{
...TogglePinMessageData,
+id: string,
-};
+}>;
export const rawTogglePinMessageInfoValidator: TInterface<RawTogglePinMessageInfo> =
tShape<RawTogglePinMessageInfo>({
diff --git a/lib/types/messages/unsupported.js b/lib/types/messages/unsupported.js
--- a/lib/types/messages/unsupported.js
+++ b/lib/types/messages/unsupported.js
@@ -2,6 +2,30 @@
import t, { type TInterface } from 'tcomb';
+import {
+ rawChangeRoleMessageInfoValidator,
+ type RawChangeRoleMessageInfo,
+} from './change-role.js';
+import {
+ rawEditMessageInfoValidator,
+ type RawEditMessageInfo,
+} from './edit.js';
+import {
+ rawMediaMessageInfoValidator,
+ type RawMediaMessageInfo,
+} from './media.js';
+import {
+ rawReactionMessageInfoValidator,
+ type RawReactionMessageInfo,
+} from './reaction.js';
+import {
+ rawTogglePinMessageInfoValidator,
+ type RawTogglePinMessageInfo,
+} from './toggle-pin.js';
+import {
+ rawUpdateFarcasterRelationshipMessageInfoValidator,
+ type RawUpdateFarcasterRelationshipMessageInfo,
+} from './update-relationship.js';
import { tID, tNumber, tShape } from '../../utils/validation-utils.js';
import { messageTypes } from '../message-types-enum.js';
import type { RelativeUserInfo } from '../user-types.js';
@@ -14,7 +38,13 @@
time: number,
robotext: string,
dontPrefixCreator?: boolean,
- unsupportedMessageInfo: Object,
+ unsupportedMessageInfo:
+ | RawUpdateFarcasterRelationshipMessageInfo
+ | RawChangeRoleMessageInfo
+ | RawEditMessageInfo
+ | RawMediaMessageInfo
+ | RawReactionMessageInfo
+ | RawTogglePinMessageInfo,
};
export const rawUnsupportedMessageInfoValidator: TInterface<RawUnsupportedMessageInfo> =
@@ -26,7 +56,17 @@
time: t.Number,
robotext: t.String,
dontPrefixCreator: t.maybe(t.Boolean),
- unsupportedMessageInfo: t.Object,
+ unsupportedMessageInfo: t.union([
+ // We include these validators here to make sure that the keyserver does
+ // ID conversion on unsupportedMessageInfo when it's one of these types
+ rawUpdateFarcasterRelationshipMessageInfoValidator,
+ rawChangeRoleMessageInfoValidator,
+ rawEditMessageInfoValidator,
+ rawMediaMessageInfoValidator,
+ rawReactionMessageInfoValidator,
+ rawTogglePinMessageInfoValidator,
+ t.Object,
+ ]),
});
export type UnsupportedMessageInfo = {
@@ -37,5 +77,11 @@
time: number,
robotext: string,
dontPrefixCreator?: boolean,
- unsupportedMessageInfo: Object,
+ unsupportedMessageInfo:
+ | RawUpdateFarcasterRelationshipMessageInfo
+ | RawChangeRoleMessageInfo
+ | RawEditMessageInfo
+ | RawMediaMessageInfo
+ | RawReactionMessageInfo
+ | RawTogglePinMessageInfo,
};
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
@@ -36,10 +36,19 @@
| UpdateTraditionalRelationshipMessageData
| UpdateFarcasterRelationshipMessageData;
-export type RawUpdateRelationshipMessageInfo = {
- ...UpdateRelationshipMessageData,
- id: string,
-};
+export type RawUpdateTraditionalRelationshipMessageInfo = $ReadOnly<{
+ ...UpdateTraditionalRelationshipMessageData,
+ +id: string,
+}>;
+
+export type RawUpdateFarcasterRelationshipMessageInfo = $ReadOnly<{
+ ...UpdateFarcasterRelationshipMessageData,
+ +id: string,
+}>;
+
+export type RawUpdateRelationshipMessageInfo =
+ | RawUpdateTraditionalRelationshipMessageInfo
+ | RawUpdateFarcasterRelationshipMessageInfo;
export const rawUpdateTraditionalRelationshipMessageInfoValidator: TInterface<RawUpdateRelationshipMessageInfo> =
tShape<RawUpdateRelationshipMessageInfo>({

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 8:39 PM (18 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2564850
Default Alt Text
D11871.diff (6 KB)

Event Timeline