diff --git a/lib/shared/messages/add-members-message-spec.js b/lib/shared/messages/add-members-message-spec.js --- a/lib/shared/messages/add-members-message-spec.js +++ b/lib/shared/messages/add-members-message-spec.js @@ -20,7 +20,7 @@ rawAddMembersMessageInfoValidator, } from '../../types/messages/add-members.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, @@ -124,7 +124,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, params: NotificationTextsParams, ): Promise { const addedMembersObject: { [string]: RelativeUserInfo } = {}; diff --git a/lib/shared/messages/change-role-message-spec.js b/lib/shared/messages/change-role-message-spec.js --- a/lib/shared/messages/change-role-message-spec.js +++ b/lib/shared/messages/change-role-message-spec.js @@ -24,7 +24,7 @@ } from '../../types/messages/change-role.js'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, @@ -158,7 +158,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, params: NotificationTextsParams, ): Promise { const membersObject: { [string]: RelativeUserInfo } = {}; diff --git a/lib/shared/messages/change-settings-message-spec.js b/lib/shared/messages/change-settings-message-spec.js --- a/lib/shared/messages/change-settings-message-spec.js +++ b/lib/shared/messages/change-settings-message-spec.js @@ -22,7 +22,7 @@ } from '../../types/messages/change-settings.js'; import type { NotifTexts } from '../../types/notif-types.js'; import { assertThreadType } from '../../types/thread-types-enum.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, type EntityText } from '../../utils/entity-text.js'; import { validHexColorRegex } from '../account-utils.js'; @@ -158,7 +158,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, params: NotificationTextsParams, ): Promise { const mostRecentMessageInfo = messageInfos[0]; diff --git a/lib/shared/messages/create-entry-message-spec.js b/lib/shared/messages/create-entry-message-spec.js --- a/lib/shared/messages/create-entry-message-spec.js +++ b/lib/shared/messages/create-entry-message-spec.js @@ -16,7 +16,7 @@ rawCreateEntryMessageInfoValidator, } from '../../types/messages/create-entry.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { prettyDate } from '../../utils/date-utils.js'; import { ET, type EntityText } from '../../utils/entity-text.js'; @@ -119,7 +119,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { return notifTextsForEntryCreationOrEdit(messageInfos, threadInfo); }, diff --git a/lib/shared/messages/create-sidebar-message-spec.js b/lib/shared/messages/create-sidebar-message-spec.js --- a/lib/shared/messages/create-sidebar-message-spec.js +++ b/lib/shared/messages/create-sidebar-message-spec.js @@ -22,7 +22,7 @@ rawCreateSidebarMessageInfoValidator, } from '../../types/messages/create-sidebar.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, @@ -173,7 +173,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, params: NotificationTextsParams, ): Promise { const createSidebarMessageInfo = messageInfos[0]; diff --git a/lib/shared/messages/create-sub-thread-message-spec.js b/lib/shared/messages/create-sub-thread-message-spec.js --- a/lib/shared/messages/create-sub-thread-message-spec.js +++ b/lib/shared/messages/create-sub-thread-message-spec.js @@ -24,7 +24,7 @@ import type { NotifTexts } from '../../types/notif-types.js'; import { threadPermissions } from '../../types/thread-permission-types.js'; import { threadTypes } from '../../types/thread-types-enum.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, type EntityText } from '../../utils/entity-text.js'; import { notifTextsForSubthreadCreation } from '../notif-utils.js'; @@ -140,7 +140,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/create-thread-message-spec.js b/lib/shared/messages/create-thread-message-spec.js --- a/lib/shared/messages/create-thread-message-spec.js +++ b/lib/shared/messages/create-thread-message-spec.js @@ -21,7 +21,7 @@ rawCreateThreadMessageInfoValidator, } from '../../types/messages/create-thread.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, @@ -157,7 +157,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/delete-entry-message-spec.js b/lib/shared/messages/delete-entry-message-spec.js --- a/lib/shared/messages/delete-entry-message-spec.js +++ b/lib/shared/messages/delete-entry-message-spec.js @@ -16,7 +16,7 @@ rawDeleteEntryMessageInfoValidator, } from '../../types/messages/delete-entry.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { prettyDate } from '../../utils/date-utils.js'; import { ET, type EntityText } from '../../utils/entity-text.js'; @@ -118,7 +118,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/edit-entry-message-spec.js b/lib/shared/messages/edit-entry-message-spec.js --- a/lib/shared/messages/edit-entry-message-spec.js +++ b/lib/shared/messages/edit-entry-message-spec.js @@ -16,7 +16,7 @@ rawEditEntryMessageInfoValidator, } from '../../types/messages/edit-entry.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { prettyDate } from '../../utils/date-utils.js'; import { ET, type EntityText } from '../../utils/entity-text.js'; @@ -119,7 +119,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { return notifTextsForEntryCreationOrEdit(messageInfos, threadInfo); }, diff --git a/lib/shared/messages/join-thread-message-spec.js b/lib/shared/messages/join-thread-message-spec.js --- a/lib/shared/messages/join-thread-message-spec.js +++ b/lib/shared/messages/join-thread-message-spec.js @@ -16,7 +16,7 @@ rawJoinThreadMessageInfoValidator, } from '../../types/messages/join-thread.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, @@ -89,7 +89,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const joinerArray: { [string]: RelativeUserInfo } = {}; for (const messageInfo of messageInfos) { diff --git a/lib/shared/messages/leave-thread-message-spec.js b/lib/shared/messages/leave-thread-message-spec.js --- a/lib/shared/messages/leave-thread-message-spec.js +++ b/lib/shared/messages/leave-thread-message-spec.js @@ -16,7 +16,7 @@ rawLeaveThreadMessageInfoValidator, } from '../../types/messages/leave-thread.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, @@ -89,7 +89,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const leaverBeavers: { [string]: RelativeUserInfo } = {}; for (const messageInfo of messageInfos) { diff --git a/lib/shared/messages/message-spec.js b/lib/shared/messages/message-spec.js --- a/lib/shared/messages/message-spec.js +++ b/lib/shared/messages/message-spec.js @@ -12,16 +12,15 @@ RawRobotextMessageInfo, } from '../../types/message-types.js'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; -import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo, UserInfo } from '../../types/user-types.js'; import type { EntityText } from '../../utils/entity-text.js'; import { type ParserRules } from '../markdown.js'; export type MessageTitleParam = { +messageInfo: Info, - +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + +threadInfo: ThreadInfo, +markdownRules: ParserRules, }; @@ -35,7 +34,9 @@ }; export type CreateMessageInfoParams = { - +threadInfos: { +[id: string]: LegacyThreadInfo }, + +threadInfos: { + +[id: string]: ThreadInfo, + }, +createMessageInfoFromRaw: (rawInfo: RawMessageInfo) => ?MessageInfo, +createRelativeUserInfos: ( userIDs: $ReadOnlyArray, @@ -43,13 +44,13 @@ }; export type RobotextParams = { - +threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, - +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, + +threadInfo: ?ThreadInfo, + +parentThreadInfo: ?ThreadInfo, }; export type NotificationTextsParams = { +notifTargetUserInfo: UserInfo, - +parentThreadInfo: ?LegacyThreadInfo, + +parentThreadInfo: ?ThreadInfo, }; export type GeneratesNotifsParams = { @@ -66,8 +67,8 @@ export type CreationSideEffectsFunc = ( messageInfo: RawInfo, - threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, - parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, + threadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ) => Promise; export type MessageSpec = { @@ -98,7 +99,7 @@ ) => ?RawMessageInfo, +notificationTexts?: ( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, params: NotificationTextsParams, ) => Promise, +notificationCollapseKey?: ( 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 @@ -42,7 +42,7 @@ import { getMediaMessageServerDBContentsFromMedia } from '../../types/messages/media.js'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET } from '../../utils/entity-text.js'; import { @@ -311,7 +311,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const media = []; for (const messageInfo of messageInfos) { 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 @@ -26,7 +26,7 @@ } from '../../types/messages/reaction.js'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET } from '../../utils/entity-text.js'; import { threadIsGroupChat } from '../thread-utils.js'; @@ -163,7 +163,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/remove-members-message-spec.js b/lib/shared/messages/remove-members-message-spec.js --- a/lib/shared/messages/remove-members-message-spec.js +++ b/lib/shared/messages/remove-members-message-spec.js @@ -20,7 +20,7 @@ rawRemoveMembersMessageInfoValidator, } from '../../types/messages/remove-members.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, @@ -125,7 +125,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, params: NotificationTextsParams, ): Promise { const removedMembersObject: { [string]: RelativeUserInfo } = {}; diff --git a/lib/shared/messages/restore-entry-message-spec.js b/lib/shared/messages/restore-entry-message-spec.js --- a/lib/shared/messages/restore-entry-message-spec.js +++ b/lib/shared/messages/restore-entry-message-spec.js @@ -16,7 +16,7 @@ rawRestoreEntryMessageInfoValidator, } from '../../types/messages/restore-entry.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { prettyDate } from '../../utils/date-utils.js'; import { ET, type EntityText } from '../../utils/entity-text.js'; @@ -118,7 +118,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( 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 @@ -25,10 +25,9 @@ type TextMessageInfo, rawTextMessageInfoValidator, } from '../../types/messages/text.js'; -import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; import { threadTypes } from '../../types/thread-types-enum.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { useDispatchActionPromise } from '../../utils/action-utils.js'; import { ET } from '../../utils/entity-text.js'; @@ -199,7 +198,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, params: NotificationTextsParams, ): Promise { // We special-case sidebarCreations. Usually we don't send any notifs in @@ -295,8 +294,8 @@ const callChangeThreadSettings = useChangeThreadSettings(); return async ( messageInfo: RawTextMessageInfo, - threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, - parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, + threadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ) => { if (threadInfo.type !== threadTypes.SIDEBAR) { return; diff --git a/lib/shared/messages/update-relationship-message-spec.js b/lib/shared/messages/update-relationship-message-spec.js --- a/lib/shared/messages/update-relationship-message-spec.js +++ b/lib/shared/messages/update-relationship-message-spec.js @@ -20,7 +20,7 @@ rawUpdateRelationshipMessageInfoValidator, } from '../../types/messages/update-relationship.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { LegacyThreadInfo } from '../../types/thread-types.js'; +import type { ThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET, type EntityText } from '../../utils/entity-text.js'; @@ -148,7 +148,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); const creator = ET.user({ userInfo: messageInfo.creator }); diff --git a/lib/shared/notif-utils.js b/lib/shared/notif-utils.js --- a/lib/shared/notif-utils.js +++ b/lib/shared/notif-utils.js @@ -61,7 +61,7 @@ function notifTextsForEntryCreationOrEdit( messageInfos: $ReadOnlyArray, - threadInfo: LegacyThreadInfo, + threadInfo: ThreadInfo, ): NotifTexts { const hasCreateEntry = messageInfos.some( messageInfo => messageInfo.type === messageTypes.CREATE_ENTRY, @@ -265,8 +265,8 @@ function notifRobotextForMessageInfo( messageInfo: RobotextMessageInfo, - threadInfo: LegacyThreadInfo, - parentThreadInfo: ?LegacyThreadInfo, + threadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ): EntityText { const robotext = robotextForMessageInfo( messageInfo, diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -1391,11 +1391,7 @@ } function getContainingThreadID( - parentThreadInfo: - | ?ServerThreadInfo - | RawThreadInfo - | ThreadInfo - | MinimallyEncodedThreadInfo, + parentThreadInfo: ?ServerThreadInfo | RawThreadInfo | ThreadInfo, threadType: ThreadType, ): ?string { if (!parentThreadInfo) {