diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -71,9 +71,9 @@ const communityThreadSelector: ( state: BaseAppState<>, -) => $ReadOnlyArray = createSelector( +) => $ReadOnlyArray = createSelector( threadInfoSelector, - (threadInfos: { +[id: string]: LegacyThreadInfo }) => { + (threadInfos: { +[id: string]: ThreadInfo }) => { const result = []; for (const threadID in threadInfos) { const threadInfo = threadInfos[threadID]; @@ -157,7 +157,7 @@ daysToEntries: { +[day: string]: string[] }, startDateString: string, endDateString: string, - onScreen: $ReadOnlyArray, + onScreen: $ReadOnlyArray, includeDeleted: boolean, ) => { const allDaysWithinRange: { [string]: string[] } = {}, @@ -207,11 +207,11 @@ ); const containedThreadInfos: (state: BaseAppState<>) => { - +[id: string]: $ReadOnlyArray, + +[id: string]: $ReadOnlyArray, } = createSelector( threadInfoSelector, - (threadInfos: { +[id: string]: LegacyThreadInfo }) => { - const result: { [string]: LegacyThreadInfo[] } = {}; + (threadInfos: { +[id: string]: ThreadInfo }) => { + const result: { [string]: ThreadInfo[] } = {}; for (const id in threadInfos) { const threadInfo = threadInfos[id]; const { containingThreadID } = threadInfo; @@ -219,7 +219,7 @@ continue; } if (result[containingThreadID] === undefined) { - result[containingThreadID] = ([]: LegacyThreadInfo[]); + result[containingThreadID] = ([]: ThreadInfo[]); } result[containingThreadID].push(threadInfo); } @@ -246,10 +246,7 @@ } = createObjectSelector( childThreadInfos, (state: BaseAppState<>) => state.messageStore, - ( - childThreads: $ReadOnlyArray, - messageStore: MessageStore, - ) => { + (childThreads: $ReadOnlyArray, messageStore: MessageStore) => { const sidebarInfos = []; for (const childThreadInfo of childThreads) { if ( @@ -298,16 +295,14 @@ const baseAncestorThreadInfos: ( threadID: string, -) => (BaseAppState<>) => $ReadOnlyArray = ( - threadID: string, -) => +) => (BaseAppState<>) => $ReadOnlyArray = (threadID: string) => createSelector( (state: BaseAppState<>) => threadInfoSelector(state), (threadInfos: { - +[id: string]: LegacyThreadInfo, - }): $ReadOnlyArray => { - const pathComponents: LegacyThreadInfo[] = []; - let node: ?LegacyThreadInfo = threadInfos[threadID]; + +[id: string]: ThreadInfo, + }): $ReadOnlyArray => { + const pathComponents: ThreadInfo[] = []; + let node: ?ThreadInfo = threadInfos[threadID]; while (node) { pathComponents.push(node); node = node.parentThreadID ? threadInfos[node.parentThreadID] : null; @@ -467,7 +462,7 @@ (state: BaseAppState<>) => threadInfoSelector(state)[threadID], (state: BaseAppState<>) => containingThreadID ? threadInfoSelector(state)[containingThreadID] : null, - (threadInfo: LegacyThreadInfo, containingThreadInfo: ?LegacyThreadInfo) => { + (threadInfo: ThreadInfo, containingThreadInfo: ?ThreadInfo) => { return () => { let threadAvatar = getAvatarForThread(threadInfo, containingThreadInfo); if (threadAvatar.type !== 'emoji') { @@ -487,14 +482,14 @@ const baseThreadInfosSelectorForThreadType: ( threadType: ThreadType, -) => (BaseAppState<>) => $ReadOnlyArray = ( +) => (BaseAppState<>) => $ReadOnlyArray = ( threadType: ThreadType, ) => createSelector( (state: BaseAppState<>) => threadInfoSelector(state), (threadInfos: { - +[id: string]: LegacyThreadInfo, - }): $ReadOnlyArray => { + +[id: string]: ThreadInfo, + }): $ReadOnlyArray => { const result = []; for (const threadID in threadInfos) { 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 @@ -1429,7 +1429,7 @@ function getThreadListSearchResults( chatListData: $ReadOnlyArray, searchText: string, - threadFilter: LegacyThreadInfo => boolean, + threadFilter: ThreadInfo => boolean, threadSearchResults: $ReadOnlySet, usersSearchResults: $ReadOnlyArray, loggedInUserInfo: ?LoggedInUserInfo, diff --git a/lib/types/messages/create-sidebar.js b/lib/types/messages/create-sidebar.js --- a/lib/types/messages/create-sidebar.js +++ b/lib/types/messages/create-sidebar.js @@ -4,7 +4,7 @@ import { tID, tNumber, tShape } from '../../utils/validation-utils.js'; import { messageTypes } from '../message-types-enum.js'; -import type { LegacyThreadInfo } from '../thread-types.js'; +import type { ThreadInfo } from '../thread-types.js'; import type { RelativeUserInfo } from '../user-types.js'; export type CreateSidebarMessageData = { @@ -51,7 +51,7 @@ +sourceMessageAuthor: RelativeUserInfo, +initialThreadState: { +name: ?string, - +parentThreadInfo: LegacyThreadInfo, + +parentThreadInfo: ThreadInfo, +color: string, +otherMembers: RelativeUserInfo[], }, diff --git a/lib/types/messages/create-subthread.js b/lib/types/messages/create-subthread.js --- a/lib/types/messages/create-subthread.js +++ b/lib/types/messages/create-subthread.js @@ -4,7 +4,7 @@ import { tID, tNumber, tShape } from '../../utils/validation-utils.js'; import { messageTypes } from '../message-types-enum.js'; -import type { LegacyThreadInfo } from '../thread-types.js'; +import type { ThreadInfo } from '../thread-types.js'; import type { RelativeUserInfo } from '../user-types.js'; export type CreateSubthreadMessageData = { @@ -36,5 +36,5 @@ threadID: string, creator: RelativeUserInfo, time: number, - childThreadInfo: LegacyThreadInfo, + childThreadInfo: ThreadInfo, }; diff --git a/lib/types/messages/create-thread.js b/lib/types/messages/create-thread.js --- a/lib/types/messages/create-thread.js +++ b/lib/types/messages/create-thread.js @@ -11,7 +11,7 @@ } from '../../utils/validation-utils.js'; import { messageTypes } from '../message-types-enum.js'; import { threadTypes, type ThreadType } from '../thread-types-enum.js'; -import { type LegacyThreadInfo } from '../thread-types.js'; +import type { ThreadInfo } from '../thread-types.js'; import type { RelativeUserInfo } from '../user-types.js'; export type CreateThreadMessageData = { @@ -58,7 +58,7 @@ initialThreadState: { type: ThreadType, name: ?string, - parentThreadInfo: ?LegacyThreadInfo, + parentThreadInfo: ?ThreadInfo, color: string, otherMembers: RelativeUserInfo[], }, diff --git a/lib/utils/entity-helpers.js b/lib/utils/entity-helpers.js --- a/lib/utils/entity-helpers.js +++ b/lib/utils/entity-helpers.js @@ -92,7 +92,7 @@ } function useResolvedThreadInfosObj( - threadInfosObj: { +[id: string]: LegacyThreadInfo }, + threadInfosObj: { +[id: string]: ThreadInfo }, options?: ?UseENSNamesOptions, ): { +[id: string]: ResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo } { const threadInfosArray = React.useMemo(