Changeset View
Changeset View
Standalone View
Standalone View
lib/shared/messages/create-thread-message-spec.js
// @flow | // @flow | ||||
import invariant from 'invariant'; | import invariant from 'invariant'; | ||||
import { | import { | ||||
pushTypes, | pushTypes, | ||||
type CreateMessageInfoParams, | type CreateMessageInfoParams, | ||||
type MessageSpec, | type MessageSpec, | ||||
type RobotextParams, | type RobotextParams, | ||||
} from './message-spec.js'; | } from './message-spec.js'; | ||||
import { assertSingleMessageInfo } from './utils.js'; | import { assertSingleMessageInfo } from './utils.js'; | ||||
import { messageTypes } from '../../types/message-types-enum.js'; | import { messageTypes } from '../../types/message-types-enum.js'; | ||||
import type { | import type { | ||||
MessageInfo, | MessageInfo, | ||||
ClientDBMessageInfo, | ClientDBMessageInfo, | ||||
} from '../../types/message-types.js'; | } from '../../types/message-types.js'; | ||||
import type { | import { | ||||
CreateThreadMessageData, | type CreateThreadMessageData, | ||||
CreateThreadMessageInfo, | type CreateThreadMessageInfo, | ||||
RawCreateThreadMessageInfo, | type RawCreateThreadMessageInfo, | ||||
rawCreateThreadMessageInfoValidator, | |||||
} from '../../types/messages/create-thread.js'; | } from '../../types/messages/create-thread.js'; | ||||
import type { NotifTexts } from '../../types/notif-types.js'; | import type { NotifTexts } from '../../types/notif-types.js'; | ||||
import type { ThreadInfo } from '../../types/thread-types.js'; | import type { ThreadInfo } from '../../types/thread-types.js'; | ||||
import type { RelativeUserInfo } from '../../types/user-types.js'; | import type { RelativeUserInfo } from '../../types/user-types.js'; | ||||
import { | import { | ||||
ET, | ET, | ||||
type EntityText, | type EntityText, | ||||
pluralizeEntityText, | pluralizeEntityText, | ||||
▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | > = Object.freeze({ | ||||
startsThread: true, | startsThread: true, | ||||
threadIDs( | threadIDs( | ||||
rawMessageInfo: RawCreateThreadMessageInfo, | rawMessageInfo: RawCreateThreadMessageInfo, | ||||
): $ReadOnlyArray<string> { | ): $ReadOnlyArray<string> { | ||||
const { parentThreadID } = rawMessageInfo.initialThreadState; | const { parentThreadID } = rawMessageInfo.initialThreadState; | ||||
return parentThreadID ? [parentThreadID] : []; | return parentThreadID ? [parentThreadID] : []; | ||||
}, | }, | ||||
validator: rawCreateThreadMessageInfoValidator, | |||||
}); | }); |