diff --git a/lib/components/chat-mention-provider.react.js b/lib/components/chat-mention-provider.react.js --- a/lib/components/chat-mention-provider.react.js +++ b/lib/components/chat-mention-provider.react.js @@ -5,13 +5,16 @@ import genesis from '../facts/genesis.js'; import { threadInfoSelector } from '../selectors/thread-selectors.js'; import SentencePrefixSearchIndex from '../shared/sentence-prefix-search-index.js'; -import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedResolvedThreadInfo, + ThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import type { ChatMentionCandidate, ChatMentionCandidatesObj, + LegacyResolvedThreadInfo, LegacyThreadInfo, - ResolvedThreadInfo, } from '../types/thread-types.js'; import { useResolvedThreadInfosObj } from '../utils/entity-helpers.js'; import { getNameForThreadEntity } from '../utils/entity-text.js'; @@ -75,7 +78,11 @@ function getChatMentionCandidates( threadInfos: { +[id: string]: LegacyThreadInfo | ThreadInfo }, - resolvedThreadInfos: { +[id: string]: ResolvedThreadInfo }, + resolvedThreadInfos: { + +[id: string]: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, + }, ): { chatMentionCandidatesObj: ChatMentionCandidatesObj, communityThreadIDForGenesisThreads: { +[id: string]: string }, @@ -211,7 +218,11 @@ function useChatMentionCandidatesObjAndUtils(): { chatMentionCandidatesObj: ChatMentionCandidatesObj, - resolvedThreadInfos: { +[id: string]: ResolvedThreadInfo }, + resolvedThreadInfos: { + +[id: string]: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, + }, communityThreadIDForGenesisThreads: { +[id: string]: string }, } { const threadInfos = useSelector(threadInfoSelector); diff --git a/lib/shared/markdown.js b/lib/shared/markdown.js --- a/lib/shared/markdown.js +++ b/lib/shared/markdown.js @@ -4,14 +4,15 @@ import * as React from 'react'; import { - markdownUserMentionRegex, decodeChatMentionText, + markdownUserMentionRegex, } from './mention-utils.js'; import { useENSNames } from '../hooks/ens-cache.js'; +import type { MinimallyEncodedResolvedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { ChatMentionCandidates, + LegacyResolvedThreadInfo, RelativeMemberInfo, - ResolvedThreadInfo, } from '../types/thread-types.js'; // simple-markdown types @@ -285,7 +286,7 @@ chatMentionCandidates: ChatMentionCandidates, capture: Capture, ): { - threadInfo: ?ResolvedThreadInfo, + threadInfo: ?(LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo), content: string, hasAccessToChat: boolean, } { diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js --- a/lib/shared/mention-utils.js +++ b/lib/shared/mention-utils.js @@ -7,13 +7,16 @@ import { stringForUserExplicit } from './user-utils.js'; import { useENSNames } from '../hooks/ens-cache.js'; import { useUserSearchIndex } from '../selectors/nav-selectors.js'; -import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedResolvedThreadInfo, + ThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import type { ChatMentionCandidates, + LegacyResolvedThreadInfo, LegacyThreadInfo, RelativeMemberInfo, - ResolvedThreadInfo, } from '../types/thread-types.js'; import { chatNameMaxLength, idSchemaRegex } from '../utils/validation-utils.js'; @@ -34,7 +37,7 @@ type MentionTypeaheadChatSuggestionItem = { +type: 'chat', - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, }; export type MentionTypeaheadSuggestionItem = @@ -74,7 +77,9 @@ return text.replace(/\\]/g, ']'); } -function getRawChatMention(threadInfo: ResolvedThreadInfo): string { +function getRawChatMention( + threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +): string { return `@[[${threadInfo.id}:${encodeChatMentionText(threadInfo.uiName)}]]`; } diff --git a/lib/shared/mention-utils.test.js b/lib/shared/mention-utils.test.js --- a/lib/shared/mention-utils.test.js +++ b/lib/shared/mention-utils.test.js @@ -1,12 +1,13 @@ // @flow import { - encodeChatMentionText, decodeChatMentionText, + encodeChatMentionText, getRawChatMention, renderChatMentionsWithAltText, } from './mention-utils.js'; -import type { ResolvedThreadInfo } from '../types/thread-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyResolvedThreadInfo } from '../types/thread-types.js'; describe('encodeChatMentionText', () => { it('should encode closing brackets', () => { @@ -36,7 +37,9 @@ it('should return raw chat mention', () => expect( getRawChatMention({ - ...(({}: any): ResolvedThreadInfo), + ...(({}: any): + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo), id: '256|123', uiName: 'thread-name', }), @@ -45,7 +48,9 @@ it('should return raw chat mention with encoded text', () => expect( getRawChatMention({ - ...(({}: any): ResolvedThreadInfo), + ...(({}: any): + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo), id: '256|123', uiName: 'thread-]name]]', }), diff --git a/lib/types/filter-types.js b/lib/types/filter-types.js --- a/lib/types/filter-types.js +++ b/lib/types/filter-types.js @@ -2,7 +2,8 @@ import t, { type TUnion } from 'tcomb'; -import type { ResolvedThreadInfo } from './thread-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } from './minimally-encoded-thread-permissions-types.js'; +import type { LegacyResolvedThreadInfo } from './thread-types.js'; import { tID, tShape, tString } from '../utils/validation-utils.js'; export const calendarThreadFilterTypes = Object.freeze({ @@ -41,6 +42,6 @@ }; export type FilterThreadInfo = { - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +numVisibleEntries: number, }; 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 @@ -16,10 +16,10 @@ } from './message-types.js'; import type { MinimallyEncodedMemberInfo, - RawThreadInfo, MinimallyEncodedRelativeMemberInfo, MinimallyEncodedResolvedThreadInfo, MinimallyEncodedRoleInfo, + RawThreadInfo, ThreadInfo, } from './minimally-encoded-thread-permissions-types.js'; import { @@ -211,10 +211,6 @@ +pinnedCount?: number, }; -export type ResolvedThreadInfo = - | LegacyResolvedThreadInfo - | MinimallyEncodedResolvedThreadInfo; - export type ServerMemberInfo = { +id: string, +role: ?string, @@ -491,7 +487,7 @@ export type ThreadStoreThreadInfos = LegacyRawThreadInfos; export type ChatMentionCandidate = { - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +rawChatName: string | ThreadEntity, }; export type ChatMentionCandidates = { diff --git a/lib/utils/drawer-utils.react.js b/lib/utils/drawer-utils.react.js --- a/lib/utils/drawer-utils.react.js +++ b/lib/utils/drawer-utils.react.js @@ -5,13 +5,14 @@ import { values } from './objects.js'; import { threadInFilterList, threadIsChannel } from '../shared/thread-utils.js'; import type { - ThreadInfo, + MinimallyEncodedResolvedThreadInfo, RawThreadInfo, + ThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; import { communitySubthreads } from '../types/thread-types-enum.js'; import type { + LegacyResolvedThreadInfo, LegacyThreadInfo, - ResolvedThreadInfo, } from '../types/thread-types.js'; type WritableCommunityDrawerItemData = { @@ -28,7 +29,9 @@ childThreadInfosMap: { +[id: string]: $ReadOnlyArray, }, - communities: $ReadOnlyArray, + communities: $ReadOnlyArray< + LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + >, labelStyles: $ReadOnlyArray, maxDepth: number, ): $ReadOnlyArray> { @@ -80,10 +83,17 @@ } function useAppendCommunitySuffix( - communities: $ReadOnlyArray, -): $ReadOnlyArray { + communities: $ReadOnlyArray< + LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + >, +): $ReadOnlyArray< + LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +> { return React.useMemo(() => { - const result: ResolvedThreadInfo[] = []; + const result: ( + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo + )[] = []; const names = new Map(); for (const chat of communities) { 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 @@ -9,17 +9,22 @@ useENSNamesForEntityText, } from './entity-text.js'; import type { UseENSNamesOptions } from '../hooks/ens-cache.js'; -import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { + MinimallyEncodedResolvedThreadInfo, + ThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyResolvedThreadInfo, LegacyThreadInfo, - ResolvedThreadInfo, } from '../types/thread-types.js'; import { values } from '../utils/objects.js'; function useResolvedThreadInfos( threadInfos: $ReadOnlyArray, options?: ?UseENSNamesOptions, -): $ReadOnlyArray { +): $ReadOnlyArray< + LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +> { const entityText = React.useMemo( () => threadInfos.map(threadInfo => threadInfo.uiName), [threadInfos], @@ -57,7 +62,9 @@ function useResolvedOptionalThreadInfos( threadInfos: ?$ReadOnlyArray, -): ?$ReadOnlyArray { +): ?$ReadOnlyArray< + LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +> { const entityText = React.useMemo(() => { if (!threadInfos) { return null; @@ -96,7 +103,7 @@ }, options?: ?UseENSNamesOptions, ): { - +[id: string]: ResolvedThreadInfo, + +[id: string]: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, } { const threadInfosArray = React.useMemo( () => values(threadInfosObj), @@ -108,7 +115,7 @@ ); return React.useMemo(() => { const obj: { - [string]: ResolvedThreadInfo, + [string]: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, } = {}; for (const resolvedThreadInfo of resolvedThreadInfosArray) { obj[resolvedThreadInfo.id] = resolvedThreadInfo; @@ -119,7 +126,7 @@ function useResolvedThreadInfo( threadInfo: LegacyThreadInfo | ThreadInfo, -): ResolvedThreadInfo { +): LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo { const resolutionInput = React.useMemo(() => [threadInfo], [threadInfo]); const [resolvedThreadInfo] = useResolvedThreadInfos(resolutionInput); return resolvedThreadInfo; @@ -127,7 +134,7 @@ function useResolvedOptionalThreadInfo( threadInfo: ?LegacyThreadInfo | ?ThreadInfo, -): ?ResolvedThreadInfo { +): ?(LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo) { const resolutionInput = React.useMemo( () => (threadInfo ? [threadInfo] : []), [threadInfo], diff --git a/native/avatars/thread-avatar.react.js b/native/avatars/thread-avatar.react.js --- a/native/avatars/thread-avatar.react.js +++ b/native/avatars/thread-avatar.react.js @@ -9,13 +9,14 @@ import { getSingleOtherUser } from 'lib/shared/thread-utils.js'; import type { AvatarSize } from 'lib/types/avatar-types.js'; import type { - ThreadInfo, + MinimallyEncodedResolvedThreadInfo, RawThreadInfo, + ThreadInfo, } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; import type { + LegacyResolvedThreadInfo, LegacyThreadInfo, - ResolvedThreadInfo, } from 'lib/types/thread-types.js'; import Avatar from './avatar.react.js'; @@ -26,7 +27,8 @@ | RawThreadInfo | LegacyThreadInfo | ThreadInfo - | ResolvedThreadInfo, + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +size: AvatarSize, }; 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 @@ -42,12 +42,15 @@ SaveEntryResult, } from 'lib/types/entry-types.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedResolvedThreadInfo, + ThreadInfo, +} 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, - ResolvedThreadInfo, } from 'lib/types/thread-types.js'; import { dateString } from 'lib/utils/date-utils.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; @@ -195,7 +198,7 @@ }; type Props = { ...SharedProps, - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, // Redux state +calendarQuery: () => CalendarQuery, +online: boolean, diff --git a/native/chat/settings/delete-thread.react.js b/native/chat/settings/delete-thread.react.js --- a/native/chat/settings/delete-thread.react.js +++ b/native/chat/settings/delete-thread.react.js @@ -25,11 +25,14 @@ identifyInvalidatedThreads, } from 'lib/shared/thread-utils.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedResolvedThreadInfo, + ThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { LeaveThreadPayload, + LegacyResolvedThreadInfo, LegacyThreadInfo, - ResolvedThreadInfo, } from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { @@ -115,7 +118,7 @@ type Props = { ...BaseProps, // Redux state - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +shouldUseDeleteConfirmationAlert: boolean, +loadingStatus: LoadingStatus, +colors: Colors, diff --git a/native/chat/settings/thread-settings-avatar.react.js b/native/chat/settings/thread-settings-avatar.react.js --- a/native/chat/settings/thread-settings-avatar.react.js +++ b/native/chat/settings/thread-settings-avatar.react.js @@ -3,13 +3,14 @@ import * as React from 'react'; import { View } from 'react-native'; -import type { ResolvedThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyResolvedThreadInfo } from 'lib/types/thread-types.js'; import EditThreadAvatar from '../../avatars/edit-thread-avatar.react.js'; import { useStyles } from '../../themes/colors.js'; type Props = { - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +canChangeSettings: boolean, }; function ThreadSettingsAvatar(props: Props): React.Node { diff --git a/native/chat/settings/thread-settings-delete-thread.react.js b/native/chat/settings/thread-settings-delete-thread.react.js --- a/native/chat/settings/thread-settings-delete-thread.react.js +++ b/native/chat/settings/thread-settings-delete-thread.react.js @@ -3,7 +3,8 @@ import * as React from 'react'; import { Text, View } from 'react-native'; -import type { ResolvedThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyResolvedThreadInfo } from 'lib/types/thread-types.js'; import type { ThreadSettingsNavigate } from './thread-settings.react.js'; import Button from '../../components/button.react.js'; @@ -12,7 +13,7 @@ import type { ViewStyle } from '../../types/styles.js'; type Props = { - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +navigate: ThreadSettingsNavigate, +buttonStyle: ViewStyle, }; diff --git a/native/chat/settings/thread-settings-name.react.js b/native/chat/settings/thread-settings-name.react.js --- a/native/chat/settings/thread-settings-name.react.js +++ b/native/chat/settings/thread-settings-name.react.js @@ -3,8 +3,8 @@ import invariant from 'invariant'; import * as React from 'react'; import { - Text, ActivityIndicator, + Text, TextInput as BaseTextInput, View, } from 'react-native'; @@ -15,14 +15,15 @@ } from 'lib/actions/thread-actions.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ChangeThreadSettingsPayload, + LegacyResolvedThreadInfo, UpdateThreadRequest, - ResolvedThreadInfo, } from 'lib/types/thread-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import { firstLine } from 'lib/utils/string-utils.js'; import { chatNameMaxLength } from 'lib/utils/validation-utils.js'; @@ -32,7 +33,7 @@ import SingleLine from '../../components/single-line.react.js'; import TextInput from '../../components/text-input.react.js'; import { useSelector } from '../../redux/redux-utils.js'; -import { type Colors, useStyles, useColors } from '../../themes/colors.js'; +import { type Colors, useColors, useStyles } from '../../themes/colors.js'; import Alert from '../../utils/alert.js'; const unboundStyles = { @@ -61,7 +62,7 @@ }; type BaseProps = { - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +nameEditValue: ?string, +setNameEditValue: (value: ?string, callback?: () => void) => void, +canChangeSettings: boolean, 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 @@ -33,14 +33,17 @@ viewerIsMember, } from 'lib/shared/thread-utils.js'; import threadWatcher from 'lib/shared/thread-watcher.js'; -import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedResolvedThreadInfo, + ThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; 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, - ResolvedThreadInfo, } from 'lib/types/thread-types.js'; import type { UserInfos } from 'lib/types/user-types.js'; import { @@ -137,20 +140,26 @@ | { +itemType: 'avatar', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +canChangeSettings: boolean, } | { +itemType: 'name', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +nameEditValue: ?string, +canChangeSettings: boolean, } | { +itemType: 'color', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +colorEditValue: string, +canChangeSettings: boolean, +navigate: ThreadSettingsNavigate, @@ -159,7 +168,9 @@ | { +itemType: 'description', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +descriptionEditValue: ?string, +descriptionTextHeight: ?number, +canChangeSettings: boolean, @@ -167,23 +178,34 @@ | { +itemType: 'parent', +key: string, - +threadInfo: ResolvedThreadInfo, - +parentThreadInfo: ?ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, + +parentThreadInfo: ?( + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo + ), } | { +itemType: 'visibility', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, } | { +itemType: 'pushNotifs', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, } | { +itemType: 'homeNotifs', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, } | { +itemType: 'seeMore', @@ -193,7 +215,9 @@ | { +itemType: 'childThread', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +firstListItem: boolean, +lastListItem: boolean, } @@ -205,7 +229,9 @@ +itemType: 'member', +key: string, +memberInfo: RelativeMemberInfo, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +canEdit: boolean, +navigate: ThreadSettingsNavigate, +firstListItem: boolean, @@ -227,14 +253,18 @@ | { +itemType: 'promoteSidebar' | 'leaveThread' | 'deleteThread', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +navigate: ThreadSettingsNavigate, +buttonStyle: ViewStyle, } | { +itemType: 'editRelationship', +key: string, - +threadInfo: ResolvedThreadInfo, + +threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, +navigate: ThreadSettingsNavigate, +buttonStyle: ViewStyle, +relationshipButton: RelationshipButton, @@ -266,9 +296,14 @@ // Redux state +userInfos: UserInfos, +viewerID: ?string, - +threadInfo: ResolvedThreadInfo, - +parentThreadInfo: ?ResolvedThreadInfo, - +childThreadInfos: ?$ReadOnlyArray, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + +parentThreadInfo: ?( + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo + ), + +childThreadInfos: ?$ReadOnlyArray< + LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + >, +somethingIsSaving: boolean, +styles: $ReadOnly, +indicatorStyle: IndicatorStyle, @@ -346,8 +381,13 @@ (propsAndState: PropsAndState) => propsAndState.navigation.navigate, (propsAndState: PropsAndState) => propsAndState.route.key, ( - threadInfo: ResolvedThreadInfo, - parentThreadInfo: ?ResolvedThreadInfo, + threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, + parentThreadInfo: ?( + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo + ), nameEditValue: ?string, colorEditValue: string, descriptionEditValue: ?string, @@ -502,9 +542,13 @@ (propsAndState: PropsAndState) => propsAndState.childThreadInfos, (propsAndState: PropsAndState) => propsAndState.numSubchannelsShowing, ( - threadInfo: ResolvedThreadInfo, + threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, navigate: ThreadSettingsNavigate, - childThreads: ?$ReadOnlyArray, + childThreads: ?$ReadOnlyArray< + LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + >, numSubchannelsShowing: number, ) => { const listData: ChatSettingsItem[] = []; @@ -569,7 +613,9 @@ (propsAndState: PropsAndState) => propsAndState.numSidebarsShowing, ( navigate: ThreadSettingsNavigate, - childThreads: ?$ReadOnlyArray, + childThreads: ?$ReadOnlyArray< + LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, + >, numSidebarsShowing: number, ) => { const listData: ChatSettingsItem[] = []; @@ -628,7 +674,9 @@ (propsAndState: PropsAndState) => propsAndState.numMembersShowing, (propsAndState: PropsAndState) => propsAndState.verticalBounds, ( - threadInfo: ResolvedThreadInfo, + threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, canStartEditing: boolean, navigate: ThreadSettingsNavigate, routeKey: string, @@ -741,8 +789,13 @@ (propsAndState: PropsAndState) => propsAndState.userInfos, (propsAndState: PropsAndState) => propsAndState.viewerID, ( - threadInfo: ResolvedThreadInfo, - parentThreadInfo: ?ResolvedThreadInfo, + threadInfo: + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo, + parentThreadInfo: ?( + | LegacyResolvedThreadInfo + | MinimallyEncodedResolvedThreadInfo + ), navigate: ThreadSettingsNavigate, styles: $ReadOnly, userInfos: UserInfos, 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 @@ -2,10 +2,13 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { + MinimallyEncodedResolvedThreadInfo, + ThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyResolvedThreadInfo, LegacyThreadInfo, - ResolvedThreadInfo, } from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; @@ -41,7 +44,7 @@ }; type Props = { ...SharedProps, - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +colors: Colors, +styles: $ReadOnly, }; 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 @@ -1,16 +1,17 @@ // @flow import * as React from 'react'; -import { Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text } from 'react-native'; -import type { ResolvedThreadInfo } from 'lib/types/thread-types.js'; +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: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +children: React.Node, ...TextProps, }; diff --git a/web/calendar/entry.react.js b/web/calendar/entry.react.js --- a/web/calendar/entry.react.js +++ b/web/calendar/entry.react.js @@ -5,17 +5,17 @@ import * as React from 'react'; import { + concurrentModificationResetActionType, createEntryActionTypes, - useCreateEntry, - saveEntryActionTypes, - useSaveEntry, deleteEntryActionTypes, + saveEntryActionTypes, + useCreateEntry, useDeleteEntry, - concurrentModificationResetActionType, + useSaveEntry, } from 'lib/actions/entry-actions.js'; import { - useModalContext, type PushModal, + useModalContext, } from 'lib/components/modal-provider.react.js'; import { connectionSelector } from 'lib/selectors/keyserver-selectors.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; @@ -23,26 +23,27 @@ import { entryKey } from 'lib/shared/entry-utils.js'; import { threadHasPermission } from 'lib/shared/thread-utils.js'; import { - type EntryInfo, + type CalendarQuery, type CreateEntryInfo, - type SaveEntryInfo, - type SaveEntryResult, - type SaveEntryPayload, type CreateEntryPayload, type DeleteEntryInfo, type DeleteEntryResult, - type CalendarQuery, + type EntryInfo, + type SaveEntryInfo, + type SaveEntryPayload, + type SaveEntryResult, } from 'lib/types/entry-types.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } 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 { ResolvedThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyResolvedThreadInfo } 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'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; @@ -54,7 +55,7 @@ import HistoryModal from '../modals/history/history-modal.react.js'; import { useSelector } from '../redux/redux-utils.js'; import { nonThreadCalendarQuery } from '../selectors/nav-selectors.js'; -import { HistoryVector, DeleteVector } from '../vectors.react.js'; +import { DeleteVector, HistoryVector } from '../vectors.react.js'; type BaseProps = { +innerRef: (key: string, me: Entry) => void, @@ -64,7 +65,7 @@ }; type Props = { ...BaseProps, - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +loggedIn: boolean, +calendarQuery: () => CalendarQuery, +online: boolean, diff --git a/web/markdown/markdown-chat-mention.react.js b/web/markdown/markdown-chat-mention.react.js --- a/web/markdown/markdown-chat-mention.react.js +++ b/web/markdown/markdown-chat-mention.react.js @@ -2,13 +2,14 @@ import * as React from 'react'; -import type { ResolvedThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyResolvedThreadInfo } from 'lib/types/thread-types.js'; import css from './markdown.css'; import { useOnClickThread } from '../selectors/thread-selectors.js'; type MarkdownChatMentionProps = { - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +hasAccessToChat: boolean, +text: string, }; diff --git a/web/modals/history/history-entry.react.js b/web/modals/history/history-entry.react.js --- a/web/modals/history/history-entry.react.js +++ b/web/modals/history/history-entry.react.js @@ -13,19 +13,20 @@ import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { colorIsDark } from 'lib/shared/color-utils.js'; import { + type CalendarQuery, type EntryInfo, type RestoreEntryInfo, - type RestoreEntryResult, - type CalendarQuery, type RestoreEntryPayload, + type RestoreEntryResult, } from 'lib/types/entry-types.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { ResolvedThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyResolvedThreadInfo } from 'lib/types/thread-types.js'; import type { UserInfo } from 'lib/types/user-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import css from './history.css'; @@ -40,7 +41,7 @@ }; type Props = { ...BaseProps, - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, +loggedIn: boolean, +restoreLoadingStatus: LoadingStatus, +calendarQuery: () => CalendarQuery, diff --git a/web/navigation-sidebar/community-list-item.react.js b/web/navigation-sidebar/community-list-item.react.js --- a/web/navigation-sidebar/community-list-item.react.js +++ b/web/navigation-sidebar/community-list-item.react.js @@ -3,7 +3,8 @@ import * as React from 'react'; import { unreadCountSelectorForCommunity } from 'lib/selectors/thread-selectors.js'; -import type { ResolvedThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedResolvedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyResolvedThreadInfo } from 'lib/types/thread-types.js'; import css from './community-list-item.css'; import { navigationSidebarLabelTooltipMargin } from './navigation-sidebar-constants.js'; @@ -14,7 +15,7 @@ import { tooltipPositions } from '../tooltips/tooltip-utils.js'; type Props = { - +threadInfo: ResolvedThreadInfo, + +threadInfo: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, }; function CommunityListItem(props: Props): React.Node {