diff --git a/lib/selectors/chat-selectors.js b/lib/selectors/chat-selectors.js --- a/lib/selectors/chat-selectors.js +++ b/lib/selectors/chat-selectors.js @@ -283,7 +283,7 @@ +startsCluster: boolean, endsCluster: boolean, +robotext: EntityText, - +threadCreatedFromMessage: ?LegacyThreadInfo | ?ThreadInfo, + +threadCreatedFromMessage: ?ThreadInfo, +reactions: ReactionInfo, }; export type ChatMessageInfoItem = @@ -296,7 +296,7 @@ +startsConversation: boolean, +startsCluster: boolean, endsCluster: boolean, - +threadCreatedFromMessage: ?LegacyThreadInfo | ?ThreadInfo, + +threadCreatedFromMessage: ?ThreadInfo, +reactions: ReactionInfo, +hasBeenEdited: boolean, +isPinned: boolean, 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 @@ -1824,18 +1824,16 @@ } if (isViewerProfile) { - const privateThreadInfo: ?(LegacyThreadInfo | ThreadInfo) = - privateThreadInfos[0]; + const privateThreadInfo: ?ThreadInfo = privateThreadInfos[0]; return privateThreadInfo ? { threadInfo: privateThreadInfo } : null; } if (usersWithPersonalThread.has(userID)) { - const personalThreadInfo: ?(LegacyThreadInfo | ThreadInfo) = - personalThreadInfos.find( - threadInfo => - userID === getSingleOtherUser(threadInfo, loggedInUserInfo.id), - ); + const personalThreadInfo: ?ThreadInfo = personalThreadInfos.find( + threadInfo => + userID === getSingleOtherUser(threadInfo, loggedInUserInfo.id), + ); return personalThreadInfo ? { threadInfo: personalThreadInfo } : null; } diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -498,6 +498,6 @@ }; export type UserProfileThreadInfo = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +pendingPersonalThreadUserInfo?: UserInfo, }; diff --git a/native/calendar/calendar.react.js b/native/calendar/calendar.react.js --- a/native/calendar/calendar.react.js +++ b/native/calendar/calendar.react.js @@ -37,7 +37,6 @@ import type { LoadingStatus } from 'lib/types/loading-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ConnectionStatus } from 'lib/types/socket-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { dateFromString, dateString, @@ -115,7 +114,7 @@ | { itemType: 'entryInfo', entryInfo: EntryInfoWithHeight, - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, }; type ExtraData = { +activeEntries: { +[key: string]: boolean }, diff --git a/native/calendar/entry.react.js b/native/calendar/entry.react.js --- a/native/calendar/entry.react.js +++ b/native/calendar/entry.react.js @@ -48,10 +48,6 @@ } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { Dispatch } from 'lib/types/redux-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; -import type { - LegacyResolvedThreadInfo, - LegacyThreadInfo, -} from 'lib/types/thread-types.js'; import { dateString } from 'lib/utils/date-utils.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { ServerError } from 'lib/utils/errors.js'; @@ -194,11 +190,11 @@ }; type BaseProps = { ...SharedProps, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; type Props = { ...SharedProps, - +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, // Redux state +calendarQuery: () => CalendarQuery, +online: boolean, diff --git a/native/chat/chat-context-provider.react.js b/native/chat/chat-context-provider.react.js --- a/native/chat/chat-context-provider.react.js +++ b/native/chat/chat-context-provider.react.js @@ -3,7 +3,6 @@ import * as React from 'react'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { SidebarAnimationType } from './chat-context.js'; import { ChatContext } from './chat-context.js'; @@ -17,7 +16,7 @@ export type MeasurementTask = { +messages: $ReadOnlyArray, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +onMessagesMeasured: ( messagesWithHeight: $ReadOnlyArray, measuredHeights: $ReadOnlyMap, @@ -38,7 +37,7 @@ const measureMessages = React.useCallback( ( messages: ?$ReadOnlyArray, - threadInfo: ?LegacyThreadInfo | ?ThreadInfo, + threadInfo: ?ThreadInfo, onMessagesMeasured: ($ReadOnlyArray) => mixed, measurerID: number, ) => { @@ -94,7 +93,7 @@ return { measure: ( messages: ?$ReadOnlyArray, - threadInfo: ?LegacyThreadInfo | ?ThreadInfo, + threadInfo: ?ThreadInfo, onMessagesMeasured: ( $ReadOnlyArray, ) => mixed, diff --git a/native/chat/chat-context.js b/native/chat/chat-context.js --- a/native/chat/chat-context.js +++ b/native/chat/chat-context.js @@ -5,14 +5,13 @@ import type { SetState } from 'lib/types/hook-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { NativeChatMessageItem } from './message-data.react.js'; import type { ChatMessageItemWithHeight } from '../types/chat-types.js'; export type MessagesMeasurer = ( ?$ReadOnlyArray, - ?LegacyThreadInfo | ?ThreadInfo, + ?ThreadInfo, ($ReadOnlyArray) => mixed, ) => void; diff --git a/native/chat/chat-input-bar.react.js b/native/chat/chat-input-bar.react.js --- a/native/chat/chat-input-bar.react.js +++ b/native/chat/chat-input-bar.react.js @@ -79,7 +79,6 @@ import type { ChatMentionCandidates, ClientThreadJoinRequest, - LegacyThreadInfo, RelativeMemberInfo, ThreadJoinPayload, } from 'lib/types/thread-types.js'; @@ -274,7 +273,7 @@ }; type BaseProps = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; type Props = { ...BaseProps, @@ -298,7 +297,7 @@ +userMentionsCandidates: $ReadOnlyArray, +chatMentionSearchIndex: SentencePrefixSearchIndex, +chatMentionCandidates: ChatMentionCandidates, - +parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + +parentThreadInfo: ?ThreadInfo, +editedMessagePreview: ?MessagePreviewResult, +editedMessageInfo: ?MessageInfo, +editMessage: ( diff --git a/native/chat/chat-router.js b/native/chat/chat-router.js --- a/native/chat/chat-router.js +++ b/native/chat/chat-router.js @@ -12,7 +12,6 @@ import { CommonActions, StackRouter } from '@react-navigation/native'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { createNavigateToThreadAction } from './message-list-types.js'; import { @@ -40,7 +39,7 @@ type ReplaceWithThreadAction = { +type: 'REPLACE_WITH_THREAD', +payload: { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }, }; type ClearThreadsAction = { @@ -52,7 +51,7 @@ type PushNewThreadAction = { +type: 'PUSH_NEW_THREAD', +payload: { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }, }; export type ChatRouterNavigationAction = @@ -64,9 +63,9 @@ export type ChatRouterNavigationHelpers = { +clearScreens: (routeNames: $ReadOnlyArray) => void, - +replaceWithThread: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, + +replaceWithThread: (threadInfo: ThreadInfo) => void, +clearThreads: (threadIDs: $ReadOnlyArray) => void, - +pushNewThread: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, + +pushNewThread: (threadInfo: ThreadInfo) => void, }; function ChatRouter( @@ -160,7 +159,7 @@ routeNames, }, }), - replaceWithThread: (threadInfo: LegacyThreadInfo | ThreadInfo) => + replaceWithThread: (threadInfo: ThreadInfo) => ({ type: replaceWithThreadActionType, payload: { threadInfo }, @@ -169,7 +168,7 @@ type: clearThreadsActionType, payload: { threadIDs }, }), - pushNewThread: (threadInfo: LegacyThreadInfo | ThreadInfo) => + pushNewThread: (threadInfo: ThreadInfo) => ({ type: pushNewThreadActionType, payload: { threadInfo }, diff --git a/native/chat/chat-thread-list-item.react.js b/native/chat/chat-thread-list-item.react.js --- a/native/chat/chat-thread-list-item.react.js +++ b/native/chat/chat-thread-list-item.react.js @@ -5,7 +5,6 @@ import type { ChatThreadItem } from 'lib/selectors/chat-selectors.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { UserInfo } from 'lib/types/user-types.js'; import { shortAbsoluteDate } from 'lib/utils/date-utils.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; @@ -24,11 +23,11 @@ type Props = { +data: ChatThreadItem, +onPressItem: ( - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, pendingPersonalThreadUserInfo?: UserInfo, ) => void, - +onPressSeeMoreSidebars: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, - +onSwipeableWillOpen: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, + +onPressSeeMoreSidebars: (threadInfo: ThreadInfo) => void, + +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void, +currentlyOpenedSwipeableId: string, }; function ChatThreadListItem({ diff --git a/native/chat/chat-thread-list-see-more-sidebars.react.js b/native/chat/chat-thread-list-see-more-sidebars.react.js --- a/native/chat/chat-thread-list-see-more-sidebars.react.js +++ b/native/chat/chat-thread-list-see-more-sidebars.react.js @@ -5,16 +5,15 @@ import { Text } from 'react-native'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { sidebarHeight } from './sidebar-item.react.js'; import Button from '../components/button.react.js'; import { useColors, useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +unread: boolean, - +onPress: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, + +onPress: (threadInfo: ThreadInfo) => void, }; function ChatThreadListSeeMoreSidebars(props: Props): React.Node { const { onPress, threadInfo, unread } = props; diff --git a/native/chat/chat-thread-list-sidebar.react.js b/native/chat/chat-thread-list-sidebar.react.js --- a/native/chat/chat-thread-list-sidebar.react.js +++ b/native/chat/chat-thread-list-sidebar.react.js @@ -4,7 +4,7 @@ import { View } from 'react-native'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo, SidebarInfo } from 'lib/types/thread-types.js'; +import type { SidebarInfo } from 'lib/types/thread-types.js'; import { sidebarHeight, SidebarItem } from './sidebar-item.react.js'; import SwipeableThread from './swipeable-thread.react.js'; @@ -16,8 +16,8 @@ type Props = { +sidebarInfo: SidebarInfo, - +onPressItem: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, - +onSwipeableWillOpen: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, + +onPressItem: (threadInfo: ThreadInfo) => void, + +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void, +currentlyOpenedSwipeableId: string, +extendArrow: boolean, }; diff --git a/native/chat/chat-thread-list.react.js b/native/chat/chat-thread-list.react.js --- a/native/chat/chat-thread-list.react.js +++ b/native/chat/chat-thread-list.react.js @@ -177,10 +177,7 @@ const searchInputRef = React.useRef>(); const onPressItem = React.useCallback( - ( - threadInfo: LegacyThreadInfo | ThreadInfo, - pendingPersonalThreadUserInfo?: UserInfo, - ) => { + (threadInfo: ThreadInfo, pendingPersonalThreadUserInfo?: UserInfo) => { onChangeSearchText(''); if (searchInputRef.current) { searchInputRef.current.blur(); diff --git a/native/chat/compose-subchannel.react.js b/native/chat/compose-subchannel.react.js --- a/native/chat/compose-subchannel.react.js +++ b/native/chat/compose-subchannel.react.js @@ -18,7 +18,6 @@ import { threadInFilterList, userIsMember } from 'lib/shared/thread-utils.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type ThreadType, threadTypes } from 'lib/types/thread-types-enum.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { type AccountUserInfo } from 'lib/types/user-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; @@ -50,7 +49,7 @@ export type ComposeSubchannelParams = { +threadType: ThreadType, - +parentThreadInfo: LegacyThreadInfo | ThreadInfo, + +parentThreadInfo: ThreadInfo, }; type Props = { @@ -205,29 +204,25 @@ threadType, }); - const existingThreads: $ReadOnlyArray = - React.useMemo(() => { - if (userInfoInputIDs.length === 0) { - return []; - } - return _flow( - _filter( - (threadInfo: LegacyThreadInfo | ThreadInfo) => - threadInFilterList(threadInfo) && - threadInfo.parentThreadID === parentThreadInfo.id && - userInfoInputIDs.every(userID => userIsMember(threadInfo, userID)), - ), - _sortBy( - ([ - 'members.length', - (threadInfo: LegacyThreadInfo | ThreadInfo) => - threadInfo.name ? 1 : 0, - ]: $ReadOnlyArray< - string | ((threadInfo: LegacyThreadInfo | ThreadInfo) => mixed), - >), - ), - )(threadInfos); - }, [userInfoInputIDs, threadInfos, parentThreadInfo]); + const existingThreads: $ReadOnlyArray = React.useMemo(() => { + if (userInfoInputIDs.length === 0) { + return []; + } + return _flow( + _filter( + (threadInfo: ThreadInfo) => + threadInFilterList(threadInfo) && + threadInfo.parentThreadID === parentThreadInfo.id && + userInfoInputIDs.every(userID => userIsMember(threadInfo, userID)), + ), + _sortBy( + ([ + 'members.length', + (threadInfo: ThreadInfo) => (threadInfo.name ? 1 : 0), + ]: $ReadOnlyArray mixed)>), + ), + )(threadInfos); + }, [userInfoInputIDs, threadInfos, parentThreadInfo]); const navigateToThread = useNavigateToThread(); const onSelectExistingThread = React.useCallback( diff --git a/native/chat/failed-send.react.js b/native/chat/failed-send.react.js --- a/native/chat/failed-send.react.js +++ b/native/chat/failed-send.react.js @@ -10,7 +10,6 @@ import type { RawComposableMessageInfo } from 'lib/types/message-types.js'; import { assertComposableRawMessage } from 'lib/types/message-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { multimediaMessageSendFailed } from './multimedia-message-utils.js'; import textMessageSendFailed from './text-message-send-failed.js'; @@ -47,7 +46,7 @@ +rawMessageInfo: ?RawComposableMessageInfo, +styles: $ReadOnly, +inputState: ?InputState, - +parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + +parentThreadInfo: ?ThreadInfo, }; class FailedSend extends React.PureComponent { retryingText = false; diff --git a/native/chat/image-paste-modal.react.js b/native/chat/image-paste-modal.react.js --- a/native/chat/image-paste-modal.react.js +++ b/native/chat/image-paste-modal.react.js @@ -7,7 +7,6 @@ import type { PhotoPaste } from 'lib/types/media-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import sleep from 'lib/utils/sleep.js'; import Modal from '../components/modal.react.js'; @@ -18,7 +17,7 @@ export type ImagePasteModalParams = { +imagePasteStagingInfo: PhotoPaste, - +thread: LegacyThreadInfo | ThreadInfo, + +thread: ThreadInfo, }; const safeAreaEdges = ['top']; diff --git a/native/chat/inline-engagement.react.js b/native/chat/inline-engagement.react.js --- a/native/chat/inline-engagement.react.js +++ b/native/chat/inline-engagement.react.js @@ -129,8 +129,8 @@ type Props = { +messageInfo: MessageInfo, - +threadInfo: LegacyThreadInfo | ThreadInfo, - +sidebarThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + +threadInfo: ThreadInfo, + +sidebarThreadInfo: ?ThreadInfo, +reactions: ReactionInfo, +disabled?: boolean, +positioning?: 'left' | 'right' | 'center', diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js --- a/native/chat/message-list-container.react.js +++ b/native/chat/message-list-container.react.js @@ -18,7 +18,6 @@ useExistingThreadInfoFinder, } from 'lib/shared/thread-utils.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { AccountUserInfo, UserListItem } from 'lib/types/user-types.js'; import { pinnedMessageCountText } from 'lib/utils/message-pinning-utils.js'; @@ -87,8 +86,8 @@ +updateTagInput: (items: $ReadOnlyArray) => void, +resolveToUser: (user: AccountUserInfo) => void, +userSearchResults: $ReadOnlyArray, - +threadInfo: LegacyThreadInfo | ThreadInfo, - +genesisThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + +threadInfo: ThreadInfo, + +genesisThreadInfo: ?ThreadInfo, +messageListData: ?$ReadOnlyArray, +colors: Colors, +styles: $ReadOnly, diff --git a/native/chat/message-list-header-title.react.js b/native/chat/message-list-header-title.react.js --- a/native/chat/message-list-header-title.react.js +++ b/native/chat/message-list-header-title.react.js @@ -6,7 +6,6 @@ import { View } from 'react-native'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { firstLine } from 'lib/utils/string-utils.js'; @@ -31,7 +30,7 @@ }; type BaseProps = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +navigate: $PropertyType, 'navigate'>, +isSearchEmpty: boolean, +areSettingsEnabled: boolean, diff --git a/native/chat/message-list-types.js b/native/chat/message-list-types.js --- a/native/chat/message-list-types.js +++ b/native/chat/message-list-types.js @@ -7,7 +7,6 @@ import { useThreadChatMentionCandidates } from 'lib/hooks/chat-mention-hooks.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { type UserInfo } from 'lib/types/user-types.js'; import { ChatContext } from './chat-context.js'; @@ -20,7 +19,7 @@ } from '../navigation/route-names.js'; export type MessageListParams = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +pendingPersonalThreadUserInfo?: UserInfo, +searching?: boolean, +removeEditMode?: ?RemoveEditMode, @@ -37,7 +36,7 @@ const MessageListContext: React.Context = React.createContext(); -function useMessageListContext(threadInfo: LegacyThreadInfo | ThreadInfo) { +function useMessageListContext(threadInfo: ThreadInfo) { const chatMentionCandidates = useThreadChatMentionCandidates(threadInfo); const getTextMessageMarkdownRules = useTextMessageRulesFunc( threadInfo, @@ -53,7 +52,7 @@ type Props = { +children: React.Node, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; function MessageListContextProvider(props: Props): React.Node { const context = useMessageListContext(props.threadInfo); @@ -96,7 +95,7 @@ } function useNavigateToThreadWithFadeAnimation( - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, messageKey: ?string, ): () => mixed { const chatContext = React.useContext(ChatContext); diff --git a/native/chat/message-result.react.js b/native/chat/message-result.react.js --- a/native/chat/message-result.react.js +++ b/native/chat/message-result.react.js @@ -5,7 +5,6 @@ import { ScrollView } from 'react-native-gesture-handler'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { longAbsoluteDate } from 'lib/utils/date-utils.js'; import { type ChatNavigationProp } from './chat.react.js'; @@ -20,7 +19,7 @@ type MessageResultProps = { +item: ChatMessageInfoItemWithHeight, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +navigation: | AppNavigationProp<'TogglePinModal'> | ChatNavigationProp<'MessageResultsScreen'> diff --git a/native/chat/message-results-screen.react.js b/native/chat/message-results-screen.react.js --- a/native/chat/message-results-screen.react.js +++ b/native/chat/message-results-screen.react.js @@ -16,7 +16,6 @@ } from 'lib/shared/message-utils.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useHeightMeasurer } from './chat-context.js'; import type { ChatNavigationProp } from './chat.react'; @@ -29,7 +28,7 @@ import type { VerticalBounds } from '../types/layout-types.js'; export type MessageResultsScreenParams = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; type MessageResultsScreenProps = { diff --git a/native/chat/parent-thread-header.react.js b/native/chat/parent-thread-header.react.js --- a/native/chat/parent-thread-header.react.js +++ b/native/chat/parent-thread-header.react.js @@ -6,7 +6,6 @@ import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadType } from 'lib/types/thread-types-enum.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useNavigateToThread } from './message-list-types.js'; import Button from '../components/button.react.js'; @@ -15,7 +14,7 @@ import { useColors, useStyles } from '../themes/colors.js'; type Props = { - +parentThreadInfo: LegacyThreadInfo | ThreadInfo, + +parentThreadInfo: ThreadInfo, +childThreadType: ThreadType, }; function ParentThreadHeader(props: Props): React.Node { diff --git a/native/chat/settings/compose-subchannel-modal.react.js b/native/chat/settings/compose-subchannel-modal.react.js --- a/native/chat/settings/compose-subchannel-modal.react.js +++ b/native/chat/settings/compose-subchannel-modal.react.js @@ -7,7 +7,6 @@ import { threadTypeDescriptions } from 'lib/shared/thread-utils.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import Button from '../../components/button.react.js'; import Modal from '../../components/modal.react.js'; @@ -19,7 +18,7 @@ export type ComposeSubchannelModalParams = { +presentedFrom: string, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; const unboundStyles = { diff --git a/native/chat/settings/thread-settings-child-thread.react.js b/native/chat/settings/thread-settings-child-thread.react.js --- a/native/chat/settings/thread-settings-child-thread.react.js +++ b/native/chat/settings/thread-settings-child-thread.react.js @@ -4,7 +4,6 @@ import { Platform, View } from 'react-native'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import ThreadAvatar from '../../avatars/thread-avatar.react.js'; import Button from '../../components/button.react.js'; @@ -14,7 +13,7 @@ import { useNavigateToThread } from '../message-list-types.js'; type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +firstListItem: boolean, +lastListItem: boolean, }; diff --git a/native/chat/settings/thread-settings-parent.react.js b/native/chat/settings/thread-settings-parent.react.js --- a/native/chat/settings/thread-settings-parent.react.js +++ b/native/chat/settings/thread-settings-parent.react.js @@ -4,7 +4,6 @@ import { Text, View } from 'react-native'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import ThreadAvatar from '../../avatars/thread-avatar.react.js'; import Button from '../../components/button.react.js'; @@ -13,7 +12,7 @@ import { useNavigateToThread } from '../message-list-types.js'; type ParentButtonProps = { - +parentThreadInfo: LegacyThreadInfo | ThreadInfo, + +parentThreadInfo: ThreadInfo, }; function ParentButton(props: ParentButtonProps): React.Node { const styles = useStyles(unboundStyles); @@ -35,8 +34,8 @@ } type ThreadSettingsParentProps = { - +threadInfo: LegacyThreadInfo | ThreadInfo, - +parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + +threadInfo: ThreadInfo, + +parentThreadInfo: ?ThreadInfo, }; function ThreadSettingsParent(props: ThreadSettingsParentProps): React.Node { const { threadInfo, parentThreadInfo } = props; diff --git a/native/chat/settings/thread-settings.react.js b/native/chat/settings/thread-settings.react.js --- a/native/chat/settings/thread-settings.react.js +++ b/native/chat/settings/thread-settings.react.js @@ -40,11 +40,7 @@ import type { RelationshipButton } from 'lib/types/relationship-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { - LegacyResolvedThreadInfo, - LegacyThreadInfo, - RelativeMemberInfo, -} from 'lib/types/thread-types.js'; +import type { RelativeMemberInfo } from 'lib/types/thread-types.js'; import type { UserInfos } from 'lib/types/user-types.js'; import { useResolvedOptionalThreadInfo, @@ -110,7 +106,7 @@ const itemPageLength = 5; export type ThreadSettingsParams = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; export type ThreadSettingsNavigate = $PropertyType< @@ -140,26 +136,20 @@ | { +itemType: 'avatar', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +canChangeSettings: boolean, } | { +itemType: 'name', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +nameEditValue: ?string, +canChangeSettings: boolean, } | { +itemType: 'color', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +colorEditValue: string, +canChangeSettings: boolean, +navigate: ThreadSettingsNavigate, @@ -168,9 +158,7 @@ | { +itemType: 'description', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +descriptionEditValue: ?string, +descriptionTextHeight: ?number, +canChangeSettings: boolean, @@ -178,34 +166,23 @@ | { +itemType: 'parent', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, - +parentThreadInfo: ?( - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo - ), + +threadInfo: MinimallyEncodedResolvedThreadInfo, + +parentThreadInfo: ?MinimallyEncodedResolvedThreadInfo, } | { +itemType: 'visibility', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, } | { +itemType: 'pushNotifs', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, } | { +itemType: 'homeNotifs', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, } | { +itemType: 'seeMore', @@ -215,9 +192,7 @@ | { +itemType: 'childThread', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +firstListItem: boolean, +lastListItem: boolean, } @@ -229,9 +204,7 @@ +itemType: 'member', +key: string, +memberInfo: RelativeMemberInfo, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +canEdit: boolean, +navigate: ThreadSettingsNavigate, +firstListItem: boolean, @@ -246,25 +219,21 @@ | { +itemType: 'mediaGallery', +key: string, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +limit: number, +verticalBounds: ?VerticalBounds, } | { +itemType: 'promoteSidebar' | 'leaveThread' | 'deleteThread', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +navigate: ThreadSettingsNavigate, +buttonStyle: ViewStyle, } | { +itemType: 'editRelationship', +key: string, - +threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +navigate: ThreadSettingsNavigate, +buttonStyle: ViewStyle, +relationshipButton: RelationshipButton, @@ -296,14 +265,9 @@ // Redux state +userInfos: UserInfos, +viewerID: ?string, - +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, - +parentThreadInfo: ?( - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo - ), - +childThreadInfos: ?$ReadOnlyArray< - LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, - >, + +threadInfo: MinimallyEncodedResolvedThreadInfo, + +parentThreadInfo: ?MinimallyEncodedResolvedThreadInfo, + +childThreadInfos: ?$ReadOnlyArray, +somethingIsSaving: boolean, +styles: $ReadOnly, +indicatorStyle: IndicatorStyle, @@ -381,13 +345,8 @@ (propsAndState: PropsAndState) => propsAndState.navigation.navigate, (propsAndState: PropsAndState) => propsAndState.route.key, ( - threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, - parentThreadInfo: ?( - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo - ), + threadInfo: MinimallyEncodedResolvedThreadInfo, + parentThreadInfo: ?MinimallyEncodedResolvedThreadInfo, nameEditValue: ?string, colorEditValue: string, descriptionEditValue: ?string, @@ -542,13 +501,9 @@ (propsAndState: PropsAndState) => propsAndState.childThreadInfos, (propsAndState: PropsAndState) => propsAndState.numSubchannelsShowing, ( - threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + threadInfo: MinimallyEncodedResolvedThreadInfo, navigate: ThreadSettingsNavigate, - childThreads: ?$ReadOnlyArray< - LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, - >, + childThreads: ?$ReadOnlyArray, numSubchannelsShowing: number, ) => { const listData: ChatSettingsItem[] = []; @@ -613,9 +568,7 @@ (propsAndState: PropsAndState) => propsAndState.numSidebarsShowing, ( navigate: ThreadSettingsNavigate, - childThreads: ?$ReadOnlyArray< - LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, - >, + childThreads: ?$ReadOnlyArray, numSidebarsShowing: number, ) => { const listData: ChatSettingsItem[] = []; @@ -674,9 +627,7 @@ (propsAndState: PropsAndState) => propsAndState.numMembersShowing, (propsAndState: PropsAndState) => propsAndState.verticalBounds, ( - threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, + threadInfo: MinimallyEncodedResolvedThreadInfo, canStartEditing: boolean, navigate: ThreadSettingsNavigate, routeKey: string, @@ -747,10 +698,7 @@ createSelector( (propsAndState: PropsAndState) => propsAndState.threadInfo, (propsAndState: PropsAndState) => propsAndState.verticalBounds, - ( - threadInfo: LegacyThreadInfo | ThreadInfo, - verticalBounds: ?VerticalBounds, - ) => { + (threadInfo: ThreadInfo, verticalBounds: ?VerticalBounds) => { const listData: ChatSettingsItem[] = []; const limit = 6; @@ -789,13 +737,8 @@ (propsAndState: PropsAndState) => propsAndState.userInfos, (propsAndState: PropsAndState) => propsAndState.viewerID, ( - threadInfo: - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo, - parentThreadInfo: ?( - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo - ), + threadInfo: MinimallyEncodedResolvedThreadInfo, + parentThreadInfo: ?MinimallyEncodedResolvedThreadInfo, navigate: ThreadSettingsNavigate, styles: $ReadOnly, userInfos: UserInfos, @@ -1209,7 +1152,7 @@ ); const threadID = props.route.params.threadInfo.id; - const reduxThreadInfo: ?LegacyThreadInfo | ?ThreadInfo = useSelector( + const reduxThreadInfo: ?ThreadInfo = useSelector( state => threadInfoSelector(state)[threadID], ); React.useEffect(() => { @@ -1226,7 +1169,7 @@ setParams({ threadInfo: reduxThreadInfo }); } }, [reduxThreadInfo, setParams]); - const threadInfo: LegacyThreadInfo | ThreadInfo = + const threadInfo: ThreadInfo = reduxThreadInfo ?? props.route.params.threadInfo; const resolvedThreadInfo = useResolvedThreadInfo(threadInfo); @@ -1241,9 +1184,8 @@ }, [threadInfo]); const parentThreadID = threadInfo.parentThreadID; - const parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo = useSelector( - state => - parentThreadID ? threadInfoSelector(state)[parentThreadID] : null, + const parentThreadInfo: ?ThreadInfo = useSelector(state => + parentThreadID ? threadInfoSelector(state)[parentThreadID] : null, ); const resolvedParentThreadInfo = useResolvedOptionalThreadInfo(parentThreadInfo); diff --git a/native/chat/sidebar-navigation.js b/native/chat/sidebar-navigation.js --- a/native/chat/sidebar-navigation.js +++ b/native/chat/sidebar-navigation.js @@ -11,10 +11,7 @@ createUnresolvedPendingSidebar, } from 'lib/shared/thread-utils.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { - ChatMentionCandidates, - LegacyThreadInfo, -} from 'lib/types/thread-types.js'; +import type { ChatMentionCandidates } from 'lib/types/thread-types.js'; import type { LoggedInUserInfo } from 'lib/types/user-types.js'; import type { GetENSNames } from 'lib/utils/ens-helpers.js'; @@ -30,7 +27,7 @@ }; function getUnresolvedSidebarThreadInfo( input: GetUnresolvedSidebarThreadInfoInput, -): ?LegacyThreadInfo | ?ThreadInfo { +): ?ThreadInfo { const { sourceMessage, loggedInUserInfo, chatMentionCandidates } = input; const threadCreatedFromMessage = sourceMessage.threadCreatedFromMessage; if (threadCreatedFromMessage) { @@ -57,7 +54,7 @@ }; async function getSidebarThreadInfo( input: GetSidebarThreadInfoInput, -): Promise { +): Promise { const { sourceMessage, loggedInUserInfo, diff --git a/native/chat/swipeable-thread.react.js b/native/chat/swipeable-thread.react.js --- a/native/chat/swipeable-thread.react.js +++ b/native/chat/swipeable-thread.react.js @@ -8,15 +8,14 @@ import useToggleUnreadStatus from 'lib/hooks/toggle-unread-status.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import Swipeable from '../components/swipeable.js'; import { useColors } from '../themes/colors.js'; type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +mostRecentNonLocalMessage: ?string, - +onSwipeableWillOpen: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, + +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void, +currentlyOpenedSwipeableId?: string, +iconSize: number, +children: React.Node, diff --git a/native/chat/thread-list-modal.react.js b/native/chat/thread-list-modal.react.js --- a/native/chat/thread-list-modal.react.js +++ b/native/chat/thread-list-modal.react.js @@ -14,7 +14,7 @@ import type { ChatThreadItem } from 'lib/selectors/chat-selectors.js'; import type { SetState } from 'lib/types/hook-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo, SidebarInfo } from 'lib/types/thread-types.js'; +import type { SidebarInfo } from 'lib/types/thread-types.js'; import { useNavigateToThread } from './message-list-types.js'; import Modal from '../components/modal.react.js'; @@ -35,9 +35,9 @@ } type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +createRenderItem: ( - onPressItem: (threadInfo: LegacyThreadInfo | ThreadInfo) => void, + onPressItem: (threadInfo: ThreadInfo) => void, ) => (row: { +item: U, +index: number, ... }) => React.Node, +listData: $ReadOnlyArray, +searchState: ThreadSearchState, @@ -78,7 +78,7 @@ const navigateToThread = useNavigateToThread(); const onPressItem = React.useCallback( - (threadInfo: LegacyThreadInfo | ThreadInfo) => { + (threadInfo: ThreadInfo) => { setSearchState({ text: '', results: new Set(), diff --git a/native/chat/thread-settings-button.react.js b/native/chat/thread-settings-button.react.js --- a/native/chat/thread-settings-button.react.js +++ b/native/chat/thread-settings-button.react.js @@ -3,7 +3,6 @@ import * as React from 'react'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { ChatNavigationProp } from './chat.react.js'; import Button from '../components/button.react.js'; @@ -19,7 +18,7 @@ }; type BaseProps = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +navigate: $PropertyType, 'navigate'>, }; type Props = { diff --git a/native/chat/thread-settings-header-title.react.js b/native/chat/thread-settings-header-title.react.js --- a/native/chat/thread-settings-header-title.react.js +++ b/native/chat/thread-settings-header-title.react.js @@ -5,12 +5,11 @@ import * as React from 'react'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { firstLine } from 'lib/utils/string-utils.js'; type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, ...HeaderTitleInputProps, }; function ThreadSettingsHeaderTitle(props: Props): React.Node { diff --git a/native/chat/toggle-pin-modal.react.js b/native/chat/toggle-pin-modal.react.js --- a/native/chat/toggle-pin-modal.react.js +++ b/native/chat/toggle-pin-modal.react.js @@ -10,7 +10,6 @@ } from 'lib/actions/message-actions.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import MessageResult from './message-result.react.js'; @@ -23,7 +22,7 @@ export type TogglePinModalParams = { +item: ChatMessageInfoItemWithHeight, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; type TogglePinModalProps = { diff --git a/native/chat/utils.js b/native/chat/utils.js --- a/native/chat/utils.js +++ b/native/chat/utils.js @@ -10,7 +10,6 @@ import { messageKey } from 'lib/shared/message-utils.js'; import { viewerIsMember } from 'lib/shared/thread-utils.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { clusterEndHeight } from './chat-constants.js'; import { ChatContext, useHeightMeasurer } from './chat-context.js'; @@ -101,7 +100,7 @@ messageListVerticalBounds: VerticalBounds, currentInputBarHeight: number, targetInputBarHeight: number, - sidebarThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + sidebarThreadInfo: ?ThreadInfo, ): { +position: number, +color: string, diff --git a/native/components/community-pill.react.js b/native/components/community-pill.react.js --- a/native/components/community-pill.react.js +++ b/native/components/community-pill.react.js @@ -5,7 +5,6 @@ import { useKeyserverAdmin } from 'lib/shared/user-utils.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import CommIcon from './comm-icon.react.js'; import Pill from './pill.react.js'; @@ -15,7 +14,7 @@ const threadPillRoundCorners = { left: false, right: true }; type Props = { - +community: LegacyThreadInfo | ThreadInfo, + +community: ThreadInfo, }; function CommunityPill(props: Props): React.Node { const { community } = props; diff --git a/native/components/thread-ancestors-label.react.js b/native/components/thread-ancestors-label.react.js --- a/native/components/thread-ancestors-label.react.js +++ b/native/components/thread-ancestors-label.react.js @@ -6,13 +6,12 @@ import { useAncestorThreads } from 'lib/shared/ancestor-threads.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useResolvedThreadInfos } from 'lib/utils/entity-helpers.js'; import { useColors, useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; function ThreadAncestorsLabel(props: Props): React.Node { const { threadInfo } = props; diff --git a/native/components/thread-ancestors.react.js b/native/components/thread-ancestors.react.js --- a/native/components/thread-ancestors.react.js +++ b/native/components/thread-ancestors.react.js @@ -25,8 +25,9 @@ const styles = useStyles(unboundStyles); const colors = useColors(); - const ancestorThreads: $ReadOnlyArray = - useSelector(ancestorThreadInfos(threadInfo.id)); + const ancestorThreads: $ReadOnlyArray = useSelector( + ancestorThreadInfos(threadInfo.id), + ); const rightArrow = React.useMemo( () => ( diff --git a/native/components/thread-list-thread.react.js b/native/components/thread-list-thread.react.js --- a/native/components/thread-list-thread.react.js +++ b/native/components/thread-list-thread.react.js @@ -6,10 +6,6 @@ MinimallyEncodedResolvedThreadInfo, ThreadInfo, } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { - LegacyResolvedThreadInfo, - LegacyThreadInfo, -} from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import Button from './button.react.js'; @@ -40,11 +36,11 @@ }; type BaseProps = { ...SharedProps, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; type Props = { ...SharedProps, - +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +colors: Colors, +styles: $ReadOnly, }; diff --git a/native/components/thread-list.react.js b/native/components/thread-list.react.js --- a/native/components/thread-list.react.js +++ b/native/components/thread-list.react.js @@ -7,7 +7,6 @@ import SearchIndex from 'lib/shared/search-index.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import Search from './search.react.js'; import ThreadListThread from './thread-list-thread.react.js'; @@ -26,7 +25,7 @@ }; type BaseProps = { - +threadInfos: $ReadOnlyArray, + +threadInfos: $ReadOnlyArray, +onSelect: (threadID: string) => void, +itemStyle?: ViewStyle, +itemTextStyle?: TextStyle, @@ -50,27 +49,26 @@ }; textInput: ?React.ElementRef; - listDataSelector: PropsAndState => $ReadOnlyArray< - LegacyThreadInfo | ThreadInfo, - > = createSelector( - (propsAndState: PropsAndState) => propsAndState.threadInfos, - (propsAndState: PropsAndState) => propsAndState.searchText, - (propsAndState: PropsAndState) => propsAndState.searchResults, - (propsAndState: PropsAndState) => propsAndState.itemStyle, - (propsAndState: PropsAndState) => propsAndState.itemTextStyle, - ( - threadInfos: $ReadOnlyArray, - text: string, - searchResults: Set, - ): $ReadOnlyArray => - text - ? threadInfos.filter(threadInfo => searchResults.has(threadInfo.id)) - : // We spread to make sure the result of this selector updates when - // any input param (namely itemStyle or itemTextStyle) changes - [...threadInfos], - ); - - get listData(): $ReadOnlyArray { + listDataSelector: PropsAndState => $ReadOnlyArray = + createSelector( + (propsAndState: PropsAndState) => propsAndState.threadInfos, + (propsAndState: PropsAndState) => propsAndState.searchText, + (propsAndState: PropsAndState) => propsAndState.searchResults, + (propsAndState: PropsAndState) => propsAndState.itemStyle, + (propsAndState: PropsAndState) => propsAndState.itemTextStyle, + ( + threadInfos: $ReadOnlyArray, + text: string, + searchResults: Set, + ): $ReadOnlyArray => + text + ? threadInfos.filter(threadInfo => searchResults.has(threadInfo.id)) + : // We spread to make sure the result of this selector updates when + // any input param (namely itemStyle or itemTextStyle) changes + [...threadInfos], + ); + + get listData(): $ReadOnlyArray { return this.listDataSelector({ ...this.props, ...this.state }); } @@ -103,14 +101,11 @@ ); } - static keyExtractor = (threadInfo: LegacyThreadInfo | ThreadInfo): string => { + static keyExtractor = (threadInfo: ThreadInfo): string => { return threadInfo.id; }; - renderItem = (row: { - +item: LegacyThreadInfo | ThreadInfo, - ... - }): React.Node => { + renderItem = (row: { +item: ThreadInfo, ... }): React.Node => { return ( , + data: ?$ReadOnlyArray, index: number, ): { length: number, offset: number, index: number } => { return { length: 24, offset: 24 * index, index }; diff --git a/native/components/thread-pill.react.js b/native/components/thread-pill.react.js --- a/native/components/thread-pill.react.js +++ b/native/components/thread-pill.react.js @@ -3,13 +3,12 @@ import * as React from 'react'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import Pill from './pill.react.js'; type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +roundCorners?: { +left: boolean, +right: boolean }, +fontSize?: number, }; diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js --- a/native/input/input-state-container.react.js +++ b/native/input/input-state-container.react.js @@ -82,7 +82,6 @@ import { type ClientNewThreadRequest, type NewThreadResult, - type LegacyThreadInfo, } from 'lib/types/thread-types.js'; import { useServerCall } from 'lib/utils/action-utils.js'; import type { @@ -174,10 +173,7 @@ > = []; scrollToMessageCallbacks: Array<(messageID: string) => void> = []; pendingThreadCreations: Map> = new Map(); - pendingThreadUpdateHandlers: Map< - string, - (LegacyThreadInfo | ThreadInfo) => mixed, - > = new Map(); + pendingThreadUpdateHandlers: Map mixed> = new Map(); // TODO: flip the switch // Note that this enables Blob service for encrypted media only useBlobServiceUploads = false; @@ -450,8 +446,8 @@ sendTextMessage = async ( messageInfo: RawTextMessageInfo, - inputThreadInfo: LegacyThreadInfo | ThreadInfo, - parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + inputThreadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ) => { this.sendCallbacks.forEach(callback => callback()); @@ -547,9 +543,7 @@ ); }; - startThreadCreation( - threadInfo: LegacyThreadInfo | ThreadInfo, - ): Promise { + startThreadCreation(threadInfo: ThreadInfo): Promise { if (!threadIsPending(threadInfo.id)) { return Promise.resolve(threadInfo.id); } @@ -571,8 +565,8 @@ async sendTextMessageAction( messageInfo: RawTextMessageInfo, - threadInfo: LegacyThreadInfo | ThreadInfo, - parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + threadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ): Promise { try { await this.props.textMessageCreationSideEffectsFunc( @@ -609,13 +603,13 @@ } } - shouldEncryptMedia(threadInfo: LegacyThreadInfo | ThreadInfo): boolean { + shouldEncryptMedia(threadInfo: ThreadInfo): boolean { return threadInfoInsideCommunity(threadInfo, commStaffCommunity.id); } sendMultimediaMessage = async ( selections: $ReadOnlyArray, - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, ) => { this.sendCallbacks.forEach(callback => callback()); const localMessageID = this.props.nextLocalID; @@ -716,7 +710,7 @@ async uploadFiles( localMessageID: string, uploadFileInputs: $ReadOnlyArray, - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, ) { const results = await Promise.all( uploadFileInputs.map(uploadFileInput => @@ -732,7 +726,7 @@ async uploadFile( localMessageID: string, uploadFileInput: UploadFileInput, - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, ): Promise { const { ids, selection } = uploadFileInput; const { localMediaID } = ids; @@ -1342,8 +1336,8 @@ retryTextMessage = async ( rawMessageInfo: RawTextMessageInfo, - threadInfo: LegacyThreadInfo | ThreadInfo, - parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + threadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ) => { await this.sendTextMessage( { @@ -1358,7 +1352,7 @@ retryMultimediaMessage = async ( rawMessageInfo: RawMultimediaMessageInfo, localMessageID: string, - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, ): Promise => { const pendingUploads = this.state.pendingUploads[localMessageID] ?? {}; @@ -1572,8 +1566,8 @@ retryMessage = async ( localMessageID: string, - threadInfo: LegacyThreadInfo | ThreadInfo, - parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + threadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ) => { this.sendCallbacks.forEach(callback => callback()); @@ -1671,7 +1665,7 @@ setPendingThreadUpdateHandler = ( threadID: string, - pendingThreadUpdateHandler: ?(LegacyThreadInfo | ThreadInfo) => mixed, + pendingThreadUpdateHandler: ?(ThreadInfo) => mixed, ) => { if (!pendingThreadUpdateHandler) { this.pendingThreadUpdateHandlers.delete(threadID); diff --git a/native/input/input-state.js b/native/input/input-state.js --- a/native/input/input-state.js +++ b/native/input/input-state.js @@ -5,7 +5,6 @@ import type { NativeMediaSelection } from 'lib/types/media-types.js'; import type { RawTextMessageInfo } from 'lib/types/messages/text.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; export type MultimediaProcessingStep = 'transcoding' | 'uploading'; @@ -32,12 +31,12 @@ +pendingUploads: PendingMultimediaUploads, +sendTextMessage: ( messageInfo: RawTextMessageInfo, - threadInfo: LegacyThreadInfo | ThreadInfo, - parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + threadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ) => Promise, +sendMultimediaMessage: ( selections: $ReadOnlyArray, - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, ) => Promise, +editInputMessage: (params: EditInputBarMessageParameters) => void, +addEditInputMessageListener: ( @@ -49,8 +48,8 @@ +messageHasUploadFailure: (localMessageID: string) => boolean, +retryMessage: ( localMessageID: string, - threadInfo: LegacyThreadInfo | ThreadInfo, - parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo, + threadInfo: ThreadInfo, + parentThreadInfo: ?ThreadInfo, ) => Promise, +registerSendCallback: (() => void) => void, +unregisterSendCallback: (() => void) => void, @@ -58,7 +57,7 @@ +reportURIDisplayed: (uri: string, loaded: boolean) => void, +setPendingThreadUpdateHandler: ( threadID: string, - pendingThreadUpdateHandler: ?(LegacyThreadInfo | ThreadInfo) => mixed, + pendingThreadUpdateHandler: ?(ThreadInfo) => mixed, ) => void, +scrollToMessage: (messageKey: string) => void, +addScrollToMessageListener: ((messageKey: string) => void) => void, diff --git a/native/keyboard/keyboard-input-host.react.js b/native/keyboard/keyboard-input-host.react.js --- a/native/keyboard/keyboard-input-host.react.js +++ b/native/keyboard/keyboard-input-host.react.js @@ -7,7 +7,6 @@ import type { MediaLibrarySelection } from 'lib/types/media-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { KeyboardContext, type KeyboardState } from './keyboard-state.js'; import { type InputState, InputStateContext } from '../input/input-state.js'; @@ -76,7 +75,7 @@ keyboardName: string, result: { +selections: $ReadOnlyArray, - +threadInfo: ?LegacyThreadInfo | ?ThreadInfo, + +threadInfo: ?ThreadInfo, }, ) => { const { keyboardState } = this.props; diff --git a/native/markdown/markdown-chat-mention.react.js b/native/markdown/markdown-chat-mention.react.js --- a/native/markdown/markdown-chat-mention.react.js +++ b/native/markdown/markdown-chat-mention.react.js @@ -4,14 +4,13 @@ import { StyleSheet, Text } from 'react-native'; import type { MinimallyEncodedResolvedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyResolvedThreadInfo } from 'lib/types/thread-types.js'; import { useMarkdownOnPressUtils } from './markdown-utils.js'; import { useNavigateToThreadWithFadeAnimation } from '../chat/message-list-types.js'; type TextProps = React.ElementConfig; type Props = { - +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + +threadInfo: MinimallyEncodedResolvedThreadInfo, +children: React.Node, ...TextProps, }; diff --git a/native/media/chat-camera-modal.react.js b/native/media/chat-camera-modal.react.js --- a/native/media/chat-camera-modal.react.js +++ b/native/media/chat-camera-modal.react.js @@ -5,7 +5,6 @@ import type { PhotoCapture } from 'lib/types/media-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import CameraModal from './camera-modal.react.js'; import { InputStateContext } from '../input/input-state.js'; @@ -14,7 +13,7 @@ export type ChatCameraModalParams = { +presentedFrom: string, - +thread: LegacyThreadInfo | ThreadInfo, + +thread: ThreadInfo, }; type Props = { diff --git a/native/push/push-handler.react.js b/native/push/push-handler.react.js --- a/native/push/push-handler.react.js +++ b/native/push/push-handler.react.js @@ -32,7 +32,6 @@ import type { Dispatch } from 'lib/types/redux-types.js'; import { type ConnectionInfo } from 'lib/types/socket-types.js'; import type { GlobalTheme } from 'lib/types/theme-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { convertNonPendingIDToNewSchema, convertNotificationMessageInfoToNewIDSchema, @@ -106,7 +105,7 @@ +[keyserverID: string]: ?string, }, +threadInfos: { - +[id: string]: LegacyThreadInfo | ThreadInfo, + +[id: string]: ThreadInfo, }, +notifPermissionAlertInfo: NotifPermissionAlertInfo, +connection: ConnectionInfo, @@ -524,10 +523,7 @@ ); } - navigateToThread( - threadInfo: LegacyThreadInfo | ThreadInfo, - clearChatRoutes: boolean, - ) { + navigateToThread(threadInfo: ThreadInfo, clearChatRoutes: boolean) { if (clearChatRoutes) { this.props.navigation.dispatch({ type: replaceWithThreadActionType, diff --git a/native/search/message-search.react.js b/native/search/message-search.react.js --- a/native/search/message-search.react.js +++ b/native/search/message-search.react.js @@ -13,7 +13,6 @@ } from 'lib/shared/search-utils.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import SearchFooter from './search-footer.react.js'; import { MessageSearchContext } from './search-provider.react.js'; @@ -29,7 +28,7 @@ import type { VerticalBounds } from '../types/layout-types.js'; export type MessageSearchParams = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, }; export type MessageSearchProps = { diff --git a/native/search/search-messages-button.react.js b/native/search/search-messages-button.react.js --- a/native/search/search-messages-button.react.js +++ b/native/search/search-messages-button.react.js @@ -3,7 +3,6 @@ import * as React from 'react'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { ChatNavigationProp } from '../chat/chat.react.js'; import Button from '../components/button.react.js'; @@ -12,7 +11,7 @@ import { useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +navigate: $PropertyType, 'navigate'>, }; diff --git a/native/selectors/calendar-selectors.js b/native/selectors/calendar-selectors.js --- a/native/selectors/calendar-selectors.js +++ b/native/selectors/calendar-selectors.js @@ -9,7 +9,6 @@ import { isLoggedIn } from 'lib/selectors/user-selectors.js'; import type { EntryInfo } from 'lib/types/entry-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { dateString } from 'lib/utils/date-utils.js'; import type { AppState } from '../redux/state-types.js'; @@ -33,7 +32,7 @@ | { itemType: 'entryInfo', entryInfo: EntryInfo, - threadInfo: LegacyThreadInfo | ThreadInfo, + threadInfo: ThreadInfo, }; const calendarListData: (state: AppState) => ?(CalendarItem[]) = createSelector( @@ -44,7 +43,7 @@ loggedIn: boolean, daysToEntries: { +[dayString: string]: EntryInfo[] }, threadInfos: { - +[id: string]: LegacyThreadInfo | ThreadInfo, + +[id: string]: ThreadInfo, }, ) => { if (!loggedIn || daysToEntries[dateString(new Date())] === undefined) { diff --git a/native/types/chat-types.js b/native/types/chat-types.js --- a/native/types/chat-types.js +++ b/native/types/chat-types.js @@ -8,7 +8,6 @@ } from 'lib/types/message-types.js'; import type { TextMessageInfo } from 'lib/types/messages/text.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { EntityText } from 'lib/utils/entity-text.js'; import type { MessagePendingUploads } from '../input/input-state.js'; @@ -17,12 +16,12 @@ +itemType: 'message', +messageShapeType: 'robotext', +messageInfo: RobotextMessageInfo, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +startsConversation: boolean, +startsCluster: boolean, +endsCluster: boolean, +robotext: EntityText, - +threadCreatedFromMessage: ?LegacyThreadInfo | ?ThreadInfo, + +threadCreatedFromMessage: ?ThreadInfo, +contentHeight: number, +reactions: ReactionInfo, }; @@ -32,12 +31,12 @@ +messageShapeType: 'text', +messageInfo: TextMessageInfo, +localMessageInfo: ?LocalMessageInfo, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +startsConversation: boolean, +startsCluster: boolean, +endsCluster: boolean, +contentHeight: number, - +threadCreatedFromMessage: ?LegacyThreadInfo | ?ThreadInfo, + +threadCreatedFromMessage: ?ThreadInfo, +reactions: ReactionInfo, +hasBeenEdited: ?boolean, +isPinned: ?boolean, @@ -57,11 +56,11 @@ +messageShapeType: 'multimedia', +messageInfo: MultimediaMessageInfo, +localMessageInfo: ?LocalMessageInfo, - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +startsConversation: boolean, +startsCluster: boolean, +endsCluster: boolean, - +threadCreatedFromMessage: ?LegacyThreadInfo | ?ThreadInfo, + +threadCreatedFromMessage: ?ThreadInfo, +pendingUploads: ?MessagePendingUploads, +reactions: ReactionInfo, +hasBeenEdited: ?boolean, diff --git a/native/user-profile/user-profile-message-button.react.js b/native/user-profile/user-profile-message-button.react.js --- a/native/user-profile/user-profile-message-button.react.js +++ b/native/user-profile/user-profile-message-button.react.js @@ -5,7 +5,6 @@ import { Text } from 'react-native'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { UserInfo } from 'lib/types/user-types'; import { useNavigateToThread } from '../chat/message-list-types.js'; @@ -14,7 +13,7 @@ import { useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +pendingPersonalThreadUserInfo?: UserInfo, }; diff --git a/native/utils/drawer-utils.react.js b/native/utils/drawer-utils.react.js --- a/native/utils/drawer-utils.react.js +++ b/native/utils/drawer-utils.react.js @@ -2,13 +2,12 @@ import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypeIsCommunityRoot } from 'lib/types/thread-types-enum.js'; -import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { CommunityDrawerItemData } from 'lib/utils/drawer-utils.react.js'; import type { TextStyle } from '../types/styles.js'; export type CommunityDrawerItemDataFlattened = { - +threadInfo: LegacyThreadInfo | ThreadInfo, + +threadInfo: ThreadInfo, +hasSubchannelsButton: boolean, +labelStyle: TextStyle, +hasChildren: boolean,