Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3703158
D9324.id31873.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
D9324.id31873.diff
View Options
diff --git a/lib/shared/messages/sidebar-source-message-spec.js b/lib/shared/messages/sidebar-source-message-spec.js
--- a/lib/shared/messages/sidebar-source-message-spec.js
+++ b/lib/shared/messages/sidebar-source-message-spec.js
@@ -86,6 +86,12 @@
`${content.sourceMessageID} which is not present in the database`,
);
}
+
+ invariant(
+ sourceMessage && !isInvalidSidebarSource(sourceMessage),
+ 'SIDEBAR_SOURCE should not point to an invalid message type',
+ );
+
return {
type: messageTypes.SIDEBAR_SOURCE,
id: row.id.toString(),
diff --git a/lib/types/message-types.js b/lib/types/message-types.js
--- a/lib/types/message-types.js
+++ b/lib/types/message-types.js
@@ -199,12 +199,32 @@
// Raw*MessageInfo = used by server, and contained in client's local store
// *MessageInfo = used by client in UI code
+export type ValidRawSidebarSourceMessageInfo =
+ | RawTextMessageInfo
+ | RawCreateThreadMessageInfo
+ | RawAddMembersMessageInfo
+ | RawCreateSubthreadMessageInfo
+ | RawChangeSettingsMessageInfo
+ | RawRemoveMembersMessageInfo
+ | RawChangeRoleMessageInfo
+ | RawLeaveThreadMessageInfo
+ | RawJoinThreadMessageInfo
+ | RawCreateEntryMessageInfo
+ | RawEditEntryMessageInfo
+ | RawDeleteEntryMessageInfo
+ | RawRestoreEntryMessageInfo
+ | RawImagesMessageInfo
+ | RawMediaMessageInfo
+ | RawUpdateRelationshipMessageInfo
+ | RawCreateSidebarMessageInfo
+ | RawUnsupportedMessageInfo;
+
export type SidebarSourceMessageData = {
+type: 17,
+threadID: string,
+creatorID: string,
+time: number,
- +sourceMessage?: RawComposableMessageInfo | RawRobotextMessageInfo,
+ +sourceMessage?: ValidRawSidebarSourceMessageInfo,
};
export type MessageData =
@@ -358,13 +378,33 @@
| MultimediaMessageInfo
| ReactionMessageInfo;
+export type ValidSidebarSourceMessageInfo =
+ | TextMessageInfo
+ | CreateThreadMessageInfo
+ | AddMembersMessageInfo
+ | CreateSubthreadMessageInfo
+ | ChangeSettingsMessageInfo
+ | RemoveMembersMessageInfo
+ | ChangeRoleMessageInfo
+ | LeaveThreadMessageInfo
+ | JoinThreadMessageInfo
+ | CreateEntryMessageInfo
+ | EditEntryMessageInfo
+ | DeleteEntryMessageInfo
+ | RestoreEntryMessageInfo
+ | ImagesMessageInfo
+ | MediaMessageInfo
+ | UpdateRelationshipMessageInfo
+ | CreateSidebarMessageInfo
+ | UnsupportedMessageInfo;
+
export type SidebarSourceMessageInfo = {
+type: 17,
+id: string,
+threadID: string,
+creator: RelativeUserInfo,
+time: number,
- +sourceMessage: ComposableMessageInfo | RobotextMessageInfo,
+ +sourceMessage: ValidSidebarSourceMessageInfo,
};
export type MessageInfo =
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 8, 7:39 PM (6 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2822451
Default Alt Text
D9324.id31873.diff (2 KB)
Attached To
Mode
D9324: [lib] Update types for SIDEBAR_SOURCE messages to reflect isInvalidSidebarSource
Attached
Detach File
Event Timeline
Log In to Comment