diff --git a/lib/shared/messages/multimedia-message-spec.js b/lib/shared/messages/multimedia-message-spec.js --- a/lib/shared/messages/multimedia-message-spec.js +++ b/lib/shared/messages/multimedia-message-spec.js @@ -192,14 +192,15 @@ messageData: MediaMessageData | ImagesMessageData, id: ?string, ): RawMediaMessageInfo | RawImagesMessageInfo { - if (messageData.type === messageTypes.IMAGES && id) { - return ({ ...messageData, id }: RawImagesMessageInfo); - } else if (messageData.type === messageTypes.IMAGES) { - return ({ ...messageData }: RawImagesMessageInfo); + const { sidebarCreation, ...rest } = messageData; + if (rest.type === messageTypes.IMAGES && id) { + return ({ ...rest, id }: RawImagesMessageInfo); + } else if (rest.type === messageTypes.IMAGES) { + return ({ ...rest }: RawImagesMessageInfo); } else if (id) { - return ({ ...messageData, id }: RawMediaMessageInfo); + return ({ ...rest, id }: RawMediaMessageInfo); } else { - return ({ ...messageData }: RawMediaMessageInfo); + return ({ ...rest }: RawMediaMessageInfo); } }, diff --git a/lib/shared/messages/text-message-spec.js b/lib/shared/messages/text-message-spec.js --- a/lib/shared/messages/text-message-spec.js +++ b/lib/shared/messages/text-message-spec.js @@ -163,10 +163,11 @@ messageData: TextMessageData, id: ?string, ): RawTextMessageInfo { + const { sidebarCreation, ...rest } = messageData; if (id) { - return { ...messageData, id }; + return { ...rest, id }; } else { - return { ...messageData }; + return { ...rest }; } }, diff --git a/lib/types/messages/images.js b/lib/types/messages/images.js --- a/lib/types/messages/images.js +++ b/lib/types/messages/images.js @@ -3,7 +3,7 @@ import type { Image } from '../media-types.js'; import type { RelativeUserInfo } from '../user-types.js'; -export type ImagesMessageData = { +type ImagesSharedBase = { +type: 14, +localID?: string, // for optimistic creations. included by new clients +threadID: string, @@ -12,8 +12,13 @@ +media: $ReadOnlyArray, }; +export type ImagesMessageData = { + ...ImagesSharedBase, + +sidebarCreation?: boolean, +}; + export type RawImagesMessageInfo = { - ...ImagesMessageData, + ...ImagesSharedBase, +id?: string, // null if local copy without ID yet }; 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 @@ -3,7 +3,7 @@ import type { Media } from '../media-types.js'; import type { RelativeUserInfo } from '../user-types.js'; -export type MediaMessageData = { +type MediaSharedBase = { +type: 15, +localID?: string, // for optimistic creations. included by new clients +threadID: string, @@ -12,8 +12,13 @@ +media: $ReadOnlyArray, }; +export type MediaMessageData = { + ...MediaSharedBase, + +sidebarCreation?: boolean, +}; + export type RawMediaMessageInfo = { - ...MediaMessageData, + ...MediaSharedBase, +id?: string, // null if local copy without ID yet }; diff --git a/lib/types/messages/text.js b/lib/types/messages/text.js --- a/lib/types/messages/text.js +++ b/lib/types/messages/text.js @@ -2,7 +2,7 @@ import type { RelativeUserInfo } from '../user-types.js'; -export type TextMessageData = { +type TextSharedBase = { +type: 0, +localID?: string, // for optimistic creations. included by new clients +threadID: string, @@ -11,8 +11,13 @@ +text: string, }; +export type TextMessageData = { + ...TextSharedBase, + +sidebarCreation?: boolean, +}; + export type RawTextMessageInfo = { - ...TextMessageData, + ...TextSharedBase, +id?: string, // null if local copy without ID yet };