diff --git a/keyserver/src/responders/message-responders.js b/keyserver/src/responders/message-responders.js --- a/keyserver/src/responders/message-responders.js +++ b/keyserver/src/responders/message-responders.js @@ -15,8 +15,8 @@ type FetchMessageInfosRequest, defaultNumberPerThread, type SendMessageResponse, - type ReactionMessageData, } from 'lib/types/message-types'; +import type { ReactionMessageData } from 'lib/types/messages/reaction'; import type { TextMessageData } from 'lib/types/messages/text'; import { threadPermissions } from 'lib/types/thread-types'; import { ServerError } from 'lib/utils/errors'; diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js --- a/lib/shared/message-utils.js +++ b/lib/shared/message-utils.js @@ -10,7 +10,6 @@ import { type MessageInfo, type RawMessageInfo, - type ReactionMessageInfo, type RobotextMessageInfo, type RawMultimediaMessageInfo, type MessageData, @@ -26,6 +25,7 @@ } from '../types/message-types'; import type { ImagesMessageData } from '../types/messages/images'; import type { MediaMessageData } from '../types/messages/media'; +import type { ReactionMessageInfo } from '../types/messages/reaction'; import { type ThreadInfo } from '../types/thread-types'; import type { RelativeUserInfo, UserInfos } from '../types/user-types'; import { codeBlockRegex, type ParserRules } from './markdown'; diff --git a/lib/shared/messages/reaction-message-spec.js b/lib/shared/messages/reaction-message-spec.js --- a/lib/shared/messages/reaction-message-spec.js +++ b/lib/shared/messages/reaction-message-spec.js @@ -8,10 +8,12 @@ messageTypes, type MessageInfo, type ClientDBMessageInfo, - type ReactionMessageData, - type RawReactionMessageInfo, - type ReactionMessageInfo, } from '../../types/message-types'; +import type { + ReactionMessageData, + RawReactionMessageInfo, + ReactionMessageInfo, +} from '../../types/messages/reaction'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported'; import type { NotifTexts } from '../../types/notif-types'; import type { ThreadInfo } from '../../types/thread-types'; 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 @@ -70,6 +70,11 @@ MediaMessageServerDBContent, RawMediaMessageInfo, } from './messages/media'; +import type { + ReactionMessageData, + RawReactionMessageInfo, + ReactionMessageInfo, +} from './messages/reaction'; import type { RawRemoveMembersMessageInfo, RemoveMembersMessageData, @@ -220,16 +225,6 @@ +sourceMessage?: RawComposableMessageInfo | RawRobotextMessageInfo, }; -export type ReactionMessageData = { - +type: 19, - +threadID: string, - +creatorID: string, - +time: number, - +targetMessageID: string, - +reaction: string, - +action: 'add_reaction' | 'remove_reaction', -}; - export type MessageData = | TextMessageData | CreateThreadMessageData @@ -281,11 +276,6 @@ id: string, }; -export type RawReactionMessageInfo = { - ...ReactionMessageData, - id: string, -}; - export type RawMessageInfo = | RawComposableMessageInfo | RawRobotextMessageInfo @@ -339,17 +329,6 @@ +sourceMessage: ComposableMessageInfo | RobotextMessageInfo, }; -export type ReactionMessageInfo = { - +type: 19, - +id: string, - +threadID: string, - +creator: RelativeUserInfo, - +time: number, - +targetMessageID: string, - +reaction: string, - +action: 'add_reaction' | 'remove_reaction', -}; - export type MessageInfo = | ComposableMessageInfo | RobotextMessageInfo diff --git a/lib/types/messages/reaction.js b/lib/types/messages/reaction.js new file mode 100644 --- /dev/null +++ b/lib/types/messages/reaction.js @@ -0,0 +1,29 @@ +// @flow + +import type { RelativeUserInfo } from '../user-types'; + +export type ReactionMessageData = { + +type: 19, + +threadID: string, + +creatorID: string, + +time: number, + +targetMessageID: string, + +reaction: string, + +action: 'add_reaction' | 'remove_reaction', +}; + +export type RawReactionMessageInfo = { + ...ReactionMessageData, + id: string, +}; + +export type ReactionMessageInfo = { + +type: 19, + +id: string, + +threadID: string, + +creator: RelativeUserInfo, + +time: number, + +targetMessageID: string, + +reaction: string, + +action: 'add_reaction' | 'remove_reaction', +}; diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js --- a/lib/types/redux-types.js +++ b/lib/types/redux-types.js @@ -39,7 +39,6 @@ import type { MessageStore, RawMultimediaMessageInfo, - RawReactionMessageInfo, FetchMessageInfosPayload, SendMessagePayload, SendReactionMessagePayload, @@ -50,6 +49,7 @@ ClientDBMessageInfo, SimpleMessagesPayload, } from './message-types'; +import type { RawReactionMessageInfo } from './messages/reaction'; import type { RawTextMessageInfo } from './messages/text'; import type { BaseNavInfo } from './nav-types'; import { diff --git a/native/chat/message-preview.react.js b/native/chat/message-preview.react.js --- a/native/chat/message-preview.react.js +++ b/native/chat/message-preview.react.js @@ -12,9 +12,9 @@ messageTypes, type MessageType, type ComposableMessageInfo, - type ReactionMessageInfo, type RobotextMessageInfo, } from 'lib/types/message-types'; +import type { ReactionMessageInfo } from 'lib/types/messages/reaction'; import { type ThreadInfo } from 'lib/types/thread-types'; import { SingleLine } from '../components/single-line.react';