diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js --- a/keyserver/src/push/send.js +++ b/keyserver/src/push/send.js @@ -1,7 +1,7 @@ // @flow -import apn from '@parse/node-apn'; import type { ResponseFailure } from '@parse/node-apn'; +import apn from '@parse/node-apn'; import invariant from 'invariant'; import _cloneDeep from 'lodash/fp/cloneDeep.js'; import _flow from 'lodash/fp/flow.js'; @@ -16,8 +16,8 @@ import { isUserMentioned } from 'lib/shared/mention-utils.js'; import { createMessageInfo, - sortMessageInfoList, shimUnsupportedRawMessageInfos, + sortMessageInfoList, } from 'lib/shared/message-utils.js'; import { messageSpecs } from 'lib/shared/messages/message-specs.js'; import { notifTextsForMessageInfo } from 'lib/shared/notif-utils.js'; @@ -29,49 +29,53 @@ import type { Platform, PlatformDetails } from 'lib/types/device-types.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import { - type RawMessageInfo, type MessageData, + type RawMessageInfo, + rawMessageInfoValidator, } from 'lib/types/message-types.js'; -import { rawMessageInfoValidator } from 'lib/types/message-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ResolvedNotifTexts } from 'lib/types/notif-types.js'; import { resolvedNotifTextsValidator } from 'lib/types/notif-types.js'; -import type { ServerThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { + LegacyThreadInfo, + ServerThreadInfo, +} from 'lib/types/thread-types.js'; import { updateTypes } from 'lib/types/update-types-enum.js'; import { type GlobalUserInfo } from 'lib/types/user-types.js'; import { values } from 'lib/utils/objects.js'; import { tID, tPlatformDetails, tShape } from 'lib/utils/validation-utils.js'; import { - prepareEncryptedAPNsNotifications, prepareEncryptedAndroidNotifications, + prepareEncryptedAPNsNotifications, prepareEncryptedWebNotifications, prepareEncryptedWNSNotifications, } from './crypto.js'; import { getAPNsNotificationTopic } from './providers.js'; import { rescindPushNotifs } from './rescind.js'; import type { + AndroidNotification, NotificationTargetDevice, - TargetedAPNsNotification, TargetedAndroidNotification, + TargetedAPNsNotification, TargetedWebNotification, TargetedWNSNotification, - AndroidNotification, } from './types.js'; import { + apnMaxNotificationPayloadByteSize, apnPush, + fcmMaxNotificationPayloadByteSize, fcmPush, getUnreadCounts, - apnMaxNotificationPayloadByteSize, - fcmMaxNotificationPayloadByteSize, - wnsMaxNotificationPayloadByteSize, webPush, - wnsPush, type WebPushError, + wnsMaxNotificationPayloadByteSize, + wnsPush, type WNSPushError, } from './utils.js'; import createIDs from '../creators/id-creator.js'; import { createUpdates } from '../creators/update-creator.js'; -import { dbQuery, SQL, mergeOrConditions } from '../database/database.js'; +import { dbQuery, mergeOrConditions, SQL } from '../database/database.js'; import type { CollapsableNotifInfo } from '../fetchers/message-fetchers.js'; import { fetchCollapsableNotifs } from '../fetchers/message-fetchers.js'; import { fetchServerThreadInfos } from '../fetchers/thread-fetchers.js'; @@ -189,7 +193,9 @@ userID: string, pushUserInfo: PushUserInfo, unreadCount: number, - threadInfos: { +[threadID: string]: ThreadInfo }, + threadInfos: { + +[threadID: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, userInfos: { +[userID: string]: GlobalUserInfo }, dbIDs: string[], // mutable rowsToSave: Map, // mutable 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,12 +5,13 @@ import genesis from '../facts/genesis.js'; import { threadInfoSelector } from '../selectors/thread-selectors.js'; import SentencePrefixSearchIndex from '../shared/sentence-prefix-search-index.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import type { - ChatMentionCandidatesObj, ChatMentionCandidate, + ChatMentionCandidatesObj, + LegacyThreadInfo, ResolvedThreadInfo, - ThreadInfo, } from '../types/thread-types.js'; import { useResolvedThreadInfosObj } from '../utils/entity-helpers.js'; import { getNameForThreadEntity } from '../utils/entity-text.js'; @@ -21,7 +22,7 @@ }; export type ChatMentionContextType = { +getChatMentionSearchIndex: ( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ) => SentencePrefixSearchIndex, +communityThreadIDForGenesisThreads: { +[id: string]: string }, +chatMentionCandidatesObj: ChatMentionCandidatesObj, @@ -43,7 +44,7 @@ const searchIndices = useChatMentionSearchIndex(chatMentionCandidatesObj); const getChatMentionSearchIndex = React.useCallback( - (threadInfo: ThreadInfo) => { + (threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo) => { if (threadInfo.community === genesis.id) { return searchIndices[communityThreadIDForGenesisThreads[threadInfo.id]]; } @@ -73,7 +74,7 @@ } function getChatMentionCandidates( - threadInfos: { +[id: string]: ThreadInfo }, + threadInfos: { +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo }, resolvedThreadInfos: { +[id: string]: ResolvedThreadInfo }, ): { chatMentionCandidatesObj: ChatMentionCandidatesObj, diff --git a/lib/hooks/chat-mention-hooks.js b/lib/hooks/chat-mention-hooks.js --- a/lib/hooks/chat-mention-hooks.js +++ b/lib/hooks/chat-mention-hooks.js @@ -8,9 +8,10 @@ type ChatMentionContextType, } from '../components/chat-mention-provider.react.js'; import genesis from '../facts/genesis.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { ChatMentionCandidates, - ThreadInfo, + LegacyThreadInfo, } from '../types/thread-types.js'; function useChatMentionContext(): ChatMentionContextType { @@ -21,7 +22,7 @@ } function useThreadChatMentionCandidates( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): ChatMentionCandidates { const { communityThreadIDForGenesisThreads, chatMentionCandidatesObj } = useChatMentionContext(); diff --git a/lib/hooks/child-threads.js b/lib/hooks/child-threads.js --- a/lib/hooks/child-threads.js +++ b/lib/hooks/child-threads.js @@ -3,24 +3,29 @@ import * as React from 'react'; import { - useFetchSingleMostRecentMessagesFromThreads, fetchSingleMostRecentMessagesFromThreadsActionTypes, + useFetchSingleMostRecentMessagesFromThreads, } from '../actions/message-actions.js'; import { - useFilteredChatListData, type ChatThreadItem, + useFilteredChatListData, } from '../selectors/chat-selectors.js'; import { useGlobalThreadSearchIndex } from '../selectors/nav-selectors.js'; import { childThreadInfos } from '../selectors/thread-selectors.js'; import { threadInChatList } from '../shared/thread-utils.js'; import threadWatcher from '../shared/thread-watcher.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; -import type { ThreadInfo } from '../types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; import { useSelector } from '../utils/redux-utils.js'; type ThreadFilter = { - +predicate?: (thread: ThreadInfo) => boolean, + +predicate?: ( + thread: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => boolean, +searchText?: string, }; @@ -41,7 +46,9 @@ }, [childThreads, predicate]); const filterSubchannels = React.useCallback( - (thread: ?(RawThreadInfo | ThreadInfo)) => { + ( + thread: ?(RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo), + ) => { const candidateThreadID = thread?.id; if (!candidateThreadID) { return false; diff --git a/lib/hooks/promote-sidebar.react.js b/lib/hooks/promote-sidebar.react.js --- a/lib/hooks/promote-sidebar.react.js +++ b/lib/hooks/promote-sidebar.react.js @@ -13,15 +13,16 @@ threadIsSidebar, } from '../shared/thread-utils.js'; import type { LoadingStatus } from '../types/loading-types.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; -import type { ThreadInfo } from '../types/thread-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; import { useSelector } from '../utils/redux-utils.js'; function canPromoteSidebar( - sidebarThreadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + sidebarThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): boolean { if (!threadIsSidebar(sidebarThreadInfo)) { return false; @@ -45,7 +46,7 @@ }; function usePromoteSidebar( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, onError?: () => mixed, ): PromoteSidebarType { const dispatchActionPromise = useDispatchActionPromise(); @@ -56,9 +57,10 @@ const loadingStatus = useSelector(loadingStatusSelector); const { parentThreadID } = threadInfo; - const parentThreadInfo: ?ThreadInfo = useSelector(state => - parentThreadID ? threadInfoSelector(state)[parentThreadID] : null, - ); + const parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo = + useSelector(state => + parentThreadID ? threadInfoSelector(state)[parentThreadID] : null, + ); const canPromote = canPromoteSidebar(threadInfo, parentThreadInfo); diff --git a/lib/hooks/relationship-prompt.js b/lib/hooks/relationship-prompt.js --- a/lib/hooks/relationship-prompt.js +++ b/lib/hooks/relationship-prompt.js @@ -8,11 +8,12 @@ updateRelationshipsActionTypes, } from '../actions/relationship-actions.js'; import { getSingleOtherUser } from '../shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { type RelationshipAction, relationshipActions, } from '../types/relationship-types.js'; -import type { ThreadInfo } from '../types/thread-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import type { UserInfo } from '../types/user-types.js'; import { useServerCall } from '../utils/action-utils.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; @@ -31,7 +32,7 @@ }; function useRelationshipPrompt( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, onErrorCallback?: () => void, pendingPersonalThreadUserInfo?: ?UserInfo, ): RelationshipPromptData { diff --git a/lib/hooks/search-threads.js b/lib/hooks/search-threads.js --- a/lib/hooks/search-threads.js +++ b/lib/hooks/search-threads.js @@ -10,8 +10,11 @@ import { sidebarInfoSelector } from '../selectors/thread-selectors.js'; import { threadIsChannel } from '../shared/thread-utils.js'; import type { SetState } from '../types/hook-types.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; -import type { SidebarInfo, ThreadInfo } from '../types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo, SidebarInfo } from '../types/thread-types.js'; import { useSelector } from '../utils/redux-utils.js'; export type ThreadSearchState = { @@ -28,7 +31,7 @@ }; function useSearchThreads( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, childThreadInfos: $ReadOnlyArray, ): SearchThreadsResult { const [searchState, setSearchState] = React.useState({ @@ -88,7 +91,7 @@ } function useSearchSidebars( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): SearchThreadsResult { const childThreadInfos = useSelector( state => sidebarInfoSelector(state)[threadInfo.id] ?? [], @@ -97,11 +100,12 @@ } function useSearchSubchannels( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): SearchThreadsResult { const filterFunc = React.useCallback( - (thread: ?(ThreadInfo | RawThreadInfo)) => - threadIsChannel(thread) && thread?.parentThreadID === threadInfo.id, + ( + thread: ?(LegacyThreadInfo | MinimallyEncodedThreadInfo | RawThreadInfo), + ) => threadIsChannel(thread) && thread?.parentThreadID === threadInfo.id, [threadInfo.id], ); const childThreadInfos = useFilteredChatListData(filterFunc); diff --git a/lib/hooks/toggle-unread-status.js b/lib/hooks/toggle-unread-status.js --- a/lib/hooks/toggle-unread-status.js +++ b/lib/hooks/toggle-unread-status.js @@ -3,18 +3,19 @@ import * as React from 'react'; import { - useSetThreadUnreadStatus, setThreadUnreadStatusActionTypes, + useSetThreadUnreadStatus, } from '../actions/activity-actions.js'; import type { SetThreadUnreadStatusPayload, SetThreadUnreadStatusRequest, } from '../types/activity-types.js'; -import type { ThreadInfo } from '../types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; function useToggleUnreadStatus( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, mostRecentNonLocalMessage: ?string, afterAction: () => void, ): () => void { 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 @@ -10,44 +10,47 @@ import { createObjectSelector } from 'reselect-map'; import { - threadInfoSelector, sidebarInfoSelector, threadInfoFromSourceMessageIDSelector, + threadInfoSelector, } from './thread-selectors.js'; import { - messageKey, - robotextForMessageInfo, createMessageInfo, getMostRecentNonLocalMessageID, + messageKey, + robotextForMessageInfo, sortMessageInfoList, } from '../shared/message-utils.js'; import { + threadInChatList, threadIsPending, threadIsTopLevel, - threadInChatList, } from '../shared/thread-utils.js'; import { messageTypes } from '../types/message-types-enum.js'; import { + type ComposableMessageInfo, + isComposableMessageType, + type LocalMessageInfo, type MessageInfo, type MessageStore, - type ComposableMessageInfo, type RobotextMessageInfo, - type LocalMessageInfo, - isComposableMessageType, } from '../types/message-types.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAppState } from '../types/redux-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import { - type SidebarInfo, - type ThreadInfo, maxReadSidebars, maxUnreadSidebars, + type SidebarInfo, + type LegacyThreadInfo, } from '../types/thread-types.js'; import type { - UserInfo, AccountUserInfo, RelativeUserInfo, + UserInfo, } from '../types/user-types.js'; import { threeDays } from '../utils/date-utils.js'; import type { EntityText } from '../utils/entity-text.js'; @@ -67,7 +70,7 @@ export type ChatThreadItem = { +type: 'chatThreadItem', - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +mostRecentMessageInfo: ?MessageInfo, +mostRecentNonLocalMessage: ?string, +lastUpdatedTime: number, @@ -95,7 +98,7 @@ } function getMostRecentMessageInfo( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, messageStore: MessageStore, messages: { +[id: string]: ?MessageInfo }, ): ?MessageInfo { @@ -114,7 +117,7 @@ } function getLastUpdatedTime( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, mostRecentMessageInfo: ?MessageInfo, ): number { return mostRecentMessageInfo @@ -123,7 +126,7 @@ } function createChatThreadItem( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, messageStore: MessageStore, messages: { +[id: string]: ?MessageInfo }, sidebarInfos: ?$ReadOnlyArray, @@ -208,7 +211,9 @@ messageInfoSelector, sidebarInfoSelector, ( - threadInfos: { +[id: string]: ThreadInfo }, + threadInfos: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, messageStore: MessageStore, messageInfos: { +[id: string]: ?MessageInfo }, sidebarInfos: { +[id: string]: $ReadOnlyArray }, @@ -227,7 +232,13 @@ } function useFilteredChatListData( - filterFunction: (threadInfo: ?(ThreadInfo | RawThreadInfo)) => boolean, + filterFunction: ( + threadInfo: ?( + | LegacyThreadInfo + | MinimallyEncodedThreadInfo + | RawThreadInfo + ), + ) => boolean, ): $ReadOnlyArray { const threadInfos = useSelector(threadInfoSelector); const messageInfos = useSelector(messageInfoSelector); @@ -248,21 +259,30 @@ } function getChatThreadItems( - threadInfos: { +[id: string]: ThreadInfo }, + threadInfos: { +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo }, messageStore: MessageStore, messageInfos: { +[id: string]: ?MessageInfo }, sidebarInfos: { +[id: string]: $ReadOnlyArray }, - filterFunction: (threadInfo: ?(ThreadInfo | RawThreadInfo)) => boolean, + filterFunction: ( + threadInfo: ?( + | LegacyThreadInfo + | MinimallyEncodedThreadInfo + | RawThreadInfo + ), + ) => boolean, ): $ReadOnlyArray { return _flow( _filter(filterFunction), - _map((threadInfo: ThreadInfo): ChatThreadItem => - createChatThreadItem( - threadInfo, - messageStore, - messageInfos, - sidebarInfos[threadInfo.id], - ), + _map( + ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ): ChatThreadItem => + createChatThreadItem( + threadInfo, + messageStore, + messageInfos, + sidebarInfos[threadInfo.id], + ), ), _orderBy('lastUpdatedTimeIncludingSidebars')('desc'), )(threadInfos); @@ -276,7 +296,7 @@ +startsCluster: boolean, endsCluster: boolean, +robotext: EntityText, - +threadCreatedFromMessage: ?ThreadInfo, + +threadCreatedFromMessage: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +reactions: ReactionInfo, }; export type ChatMessageInfoItem = @@ -289,7 +309,9 @@ +startsConversation: boolean, +startsCluster: boolean, endsCluster: boolean, - +threadCreatedFromMessage: ?ThreadInfo, + +threadCreatedFromMessage: + | ?LegacyThreadInfo + | ?MinimallyEncodedThreadInfo, +reactions: ReactionInfo, +hasBeenEdited: boolean, +isPinned: boolean, @@ -308,8 +330,10 @@ threadID: string, messageStore: MessageStore, messageInfos: { +[id: string]: ?MessageInfo }, - threadInfos: { +[id: string]: ThreadInfo }, - threadInfoFromSourceMessageID: { +[id: string]: ThreadInfo }, + threadInfos: { +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo }, + threadInfoFromSourceMessageID: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, additionalMessages: $ReadOnlyArray, viewerID: string, ): ChatMessageItem[] { @@ -580,8 +604,12 @@ ( messageStore: MessageStore, messageInfos: { +[id: string]: ?MessageInfo }, - threadInfos: { +[id: string]: ThreadInfo }, - threadInfoFromSourceMessageID: { +[id: string]: ThreadInfo }, + threadInfos: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, + threadInfoFromSourceMessageID: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, viewerID: ?string, ): ?(ChatMessageItem[]) => { if (!threadID || !viewerID) { @@ -607,7 +635,7 @@ export type UseMessageListDataArgs = { +searching: boolean, +userInfoInputArray: $ReadOnlyArray, - +threadInfo: ?ThreadInfo, + +threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; function useMessageListData({ diff --git a/lib/selectors/nav-selectors.js b/lib/selectors/nav-selectors.js --- a/lib/selectors/nav-selectors.js +++ b/lib/selectors/nav-selectors.js @@ -12,10 +12,16 @@ defaultCalendarQuery, } from '../types/entry-types.js'; import type { CalendarFilter } from '../types/filter-types.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseNavInfo } from '../types/nav-types.js'; import type { BaseAppState } from '../types/redux-types.js'; -import type { RelativeMemberInfo, ThreadInfo } from '../types/thread-types'; +import type { + LegacyThreadInfo, + RelativeMemberInfo, +} from '../types/thread-types'; import type { UserInfo } from '../types/user-types.js'; import { getConfig } from '../utils/config.js'; import { values } from '../utils/objects.js'; @@ -117,7 +123,9 @@ } function useThreadSearchIndex( - threadInfos: $ReadOnlyArray, + threadInfos: $ReadOnlyArray< + RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, + >, ): SearchIndex { const userInfos = useSelector(state => state.userStore.userInfos); const viewerID = useSelector( diff --git a/lib/shared/ancestor-threads.js b/lib/shared/ancestor-threads.js --- a/lib/shared/ancestor-threads.js +++ b/lib/shared/ancestor-threads.js @@ -4,16 +4,17 @@ import genesis from '../facts/genesis.js'; import { - threadInfoSelector, ancestorThreadInfos, + threadInfoSelector, } from '../selectors/thread-selectors.js'; import { threadIsPending } from '../shared/thread-utils.js'; -import { type ThreadInfo } from '../types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import { useSelector } from '../utils/redux-utils.js'; function useAncestorThreads( - threadInfo: ThreadInfo, -): $ReadOnlyArray { + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +): $ReadOnlyArray { const ancestorThreads = useSelector(ancestorThreadInfos(threadInfo.id)); const genesisThreadInfo = useSelector( diff --git a/lib/shared/avatar-utils.js b/lib/shared/avatar-utils.js --- a/lib/shared/avatar-utils.js +++ b/lib/shared/avatar-utils.js @@ -11,14 +11,20 @@ import { threadInfoSelector } from '../selectors/thread-selectors.js'; import { getETHAddressForUserInfo } from '../shared/account-utils.js'; import type { - ClientEmojiAvatar, ClientAvatar, - ResolvedClientAvatar, + ClientEmojiAvatar, GenericUserInfoWithAvatar, + ResolvedClientAvatar, } from '../types/avatar-types.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; -import type { LegacyRawThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { + LegacyRawThreadInfo, + LegacyThreadInfo, +} from '../types/thread-types.js'; import type { UserInfos } from '../types/user-types.js'; import { useSelector } from '../utils/redux-utils.js'; import { ashoatKeyserverID } from '../utils/validation-utils.js'; @@ -271,7 +277,11 @@ } function getUserAvatarForThread( - threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, + threadInfo: + | LegacyRawThreadInfo + | RawThreadInfo + | LegacyThreadInfo + | MinimallyEncodedThreadInfo, viewerID: ?string, userInfos: UserInfos, ): ClientAvatar { @@ -297,8 +307,8 @@ } function getAvatarForThread( - thread: RawThreadInfo | ThreadInfo, - containingThreadInfo: ?ThreadInfo, + thread: RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, + containingThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): ClientAvatar { if (thread.avatar) { return thread.avatar; @@ -313,7 +323,9 @@ return getDefaultAvatar(thread.id, thread.color); } -function useAvatarForThread(thread: RawThreadInfo | ThreadInfo): ClientAvatar { +function useAvatarForThread( + thread: RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, +): ClientAvatar { const containingThreadID = thread.containingThreadID; const containingThreadInfo = useSelector(state => containingThreadID ? threadInfoSelector(state)[containingThreadID] : null, diff --git a/lib/shared/edit-messages-utils.js b/lib/shared/edit-messages-utils.js --- a/lib/shared/edit-messages-utils.js +++ b/lib/shared/edit-messages-utils.js @@ -2,20 +2,21 @@ import * as React from 'react'; -import { threadIsPending, threadHasPermission } from './thread-utils.js'; +import { threadHasPermission, threadIsPending } from './thread-utils.js'; import { sendEditMessageActionTypes, useSendEditMessage, } from '../actions/message-actions.js'; import type { - SendEditMessageResult, - RobotextMessageInfo, ComposableMessageInfo, RawMessageInfo, + RobotextMessageInfo, + SendEditMessageResult, } from '../types/message-types'; import { messageTypes } from '../types/message-types-enum.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; -import { type ThreadInfo } from '../types/thread-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -51,7 +52,7 @@ } function useCanEditMessage( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, targetMessageInfo: ComposableMessageInfo | RobotextMessageInfo, ): boolean { const currentUserInfo = useSelector(state => state.currentUserInfo); diff --git a/lib/shared/inline-engagement-utils.js b/lib/shared/inline-engagement-utils.js --- a/lib/shared/inline-engagement-utils.js +++ b/lib/shared/inline-engagement-utils.js @@ -1,9 +1,12 @@ // @flow import type { ReactionInfo } from '../selectors/chat-selectors.js'; -import type { ThreadInfo } from '../types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; -function getInlineEngagementSidebarText(threadInfo: ?ThreadInfo): string { +function getInlineEngagementSidebarText( + threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +): string { if (!threadInfo) { return ''; } 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,14 +7,15 @@ import { stringForUserExplicit } from './user-utils.js'; import { useENSNames } from '../hooks/ens-cache.js'; import { useUserSearchIndex } from '../selectors/nav-selectors.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import type { ChatMentionCandidates, + LegacyThreadInfo, RelativeMemberInfo, - ThreadInfo, ResolvedThreadInfo, } from '../types/thread-types.js'; -import { idSchemaRegex, chatNameMaxLength } from '../utils/validation-utils.js'; +import { chatNameMaxLength, idSchemaRegex } from '../utils/validation-utils.js'; export type TypeaheadMatchedStrings = { +textBeforeAtSymbol: string, @@ -182,8 +183,8 @@ } function useUserMentionsCandidates( - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): $ReadOnlyArray { return React.useMemo(() => { if (threadInfo.type !== threadTypes.SIDEBAR) { diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js --- a/lib/shared/message-utils.js +++ b/lib/shared/message-utils.js @@ -15,21 +15,21 @@ import type { ChatMessageInfoItem } from '../selectors/chat-selectors.js'; import { threadInfoSelector } from '../selectors/thread-selectors.js'; import { userIDsToRelativeUserInfos } from '../selectors/user-selectors.js'; -import { type PlatformDetails, isWebPlatform } from '../types/device-types.js'; +import { isWebPlatform, type PlatformDetails } from '../types/device-types.js'; import type { Media } from '../types/media-types.js'; import { messageTypes } from '../types/message-types-enum.js'; import { - type MessageInfo, - type RawMessageInfo, - type RobotextMessageInfo, - type RawMultimediaMessageInfo, + type ComposableMessageInfo, type MessageData, - type MessageTruncationStatus, - type MultimediaMessageData, + type MessageInfo, type MessageStore, - type ComposableMessageInfo, + type MessageTruncationStatus, messageTruncationStatus, + type MultimediaMessageData, type RawComposableMessageInfo, + type RawMessageInfo, + type RawMultimediaMessageInfo, + type RobotextMessageInfo, type ThreadMessageInfo, } from '../types/message-types.js'; import type { @@ -42,8 +42,14 @@ RawReactionMessageInfo, ReactionMessageInfo, } from '../types/messages/reaction.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; -import type { LegacyRawThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyRawThreadInfo, + LegacyThreadInfo, +} from '../types/thread-types.js'; import type { UserInfos } from '../types/user-types.js'; import { type EntityText, @@ -76,8 +82,8 @@ function robotextForMessageInfo( messageInfo: RobotextMessageInfo, - threadInfo: ?ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): EntityText { const messageSpec = messageSpecs[messageInfo.type]; invariant( @@ -91,7 +97,7 @@ rawMessageInfo: RawMessageInfo, viewerID: ?string, userInfos: UserInfos, - threadInfos: { +[id: string]: ThreadInfo }, + threadInfos: { +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo }, ): ?MessageInfo { const creatorInfo = userInfos[rawMessageInfo.creatorID]; const creator = { @@ -412,8 +418,8 @@ | RobotextMessageInfo | ReactionMessageInfo | EditMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, markdownRules: ParserRules, ): EntityText { const { messageTitle } = messageSpecs[messageInfo.type]; @@ -499,7 +505,7 @@ }; function useMessagePreview( originalMessageInfo: ?MessageInfo, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, markdownRules: ParserRules, ): ?MessagePreviewResult { let messageInfo; @@ -681,7 +687,11 @@ function isInvalidPinSourceForThread( messageInfo: RawMessageInfo | MessageInfo, - threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, + threadInfo: + | LegacyRawThreadInfo + | RawThreadInfo + | LegacyThreadInfo + | MinimallyEncodedThreadInfo, ): boolean { const isValidPinSource = !isInvalidPinSource(messageInfo); const isFirstMessageInSidebar = threadInfo.sourceMessageID === messageInfo.id; diff --git a/lib/shared/messages/add-members-message-spec.js b/lib/shared/messages/add-members-message-spec.js --- a/lib/shared/messages/add-members-message-spec.js +++ b/lib/shared/messages/add-members-message-spec.js @@ -10,8 +10,8 @@ import { joinResult } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type AddMembersMessageData, @@ -19,12 +19,13 @@ type RawAddMembersMessageInfo, rawAddMembersMessageInfoValidator, } from '../../types/messages/add-members.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { - ET, type EntityText, + ET, pluralizeEntityText, } from '../../utils/entity-text.js'; import { values } from '../../utils/objects.js'; @@ -124,7 +125,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, params: NotificationTextsParams, ): Promise { const addedMembersObject: { [string]: RelativeUserInfo } = {}; diff --git a/lib/shared/messages/change-role-message-spec.js b/lib/shared/messages/change-role-message-spec.js --- a/lib/shared/messages/change-role-message-spec.js +++ b/lib/shared/messages/change-role-message-spec.js @@ -3,18 +3,18 @@ import invariant from 'invariant'; import { - pushTypes, type CreateMessageInfoParams, type MessageSpec, - type RobotextParams, type NotificationTextsParams, + pushTypes, + type RobotextParams, } from './message-spec.js'; import { joinResult } from './utils.js'; import type { PlatformDetails } from '../../types/device-types.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type ChangeRoleMessageData, @@ -23,15 +23,16 @@ rawChangeRoleMessageInfoValidator, } from '../../types/messages/change-role.js'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { - ET, type EntityText, + entityTextToRawString, + ET, pluralizeEntityText, } from '../../utils/entity-text.js'; -import { entityTextToRawString } from '../../utils/entity-text.js'; import { values } from '../../utils/objects.js'; import { constructChangeRoleEntityText } from '../message-utils.js'; import { notifRobotextForMessageInfo } from '../notif-utils.js'; @@ -158,7 +159,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, params: NotificationTextsParams, ): Promise { const membersObject: { [string]: RelativeUserInfo } = {}; diff --git a/lib/shared/messages/change-settings-message-spec.js b/lib/shared/messages/change-settings-message-spec.js --- a/lib/shared/messages/change-settings-message-spec.js +++ b/lib/shared/messages/change-settings-message-spec.js @@ -3,16 +3,16 @@ import invariant from 'invariant'; import { - pushTypes, type MessageSpec, - type RobotextParams, type NotificationTextsParams, + pushTypes, + type RobotextParams, } from './message-spec.js'; import { joinResult } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type ChangeSettingsMessageData, @@ -20,11 +20,12 @@ type RawChangeSettingsMessageInfo, rawChangeSettingsMessageInfoValidator, } from '../../types/messages/change-settings.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; import { assertThreadType } from '../../types/thread-types-enum.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; -import { ET, type EntityText } from '../../utils/entity-text.js'; +import { type EntityText, ET } from '../../utils/entity-text.js'; import { validHexColorRegex } from '../account-utils.js'; import { notifRobotextForMessageInfo } from '../notif-utils.js'; import { threadLabel } from '../thread-utils.js'; @@ -158,7 +159,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, params: NotificationTextsParams, ): Promise { const mostRecentMessageInfo = messageInfos[0]; diff --git a/lib/shared/messages/create-entry-message-spec.js b/lib/shared/messages/create-entry-message-spec.js --- a/lib/shared/messages/create-entry-message-spec.js +++ b/lib/shared/messages/create-entry-message-spec.js @@ -2,12 +2,12 @@ import invariant from 'invariant'; -import { pushTypes, type MessageSpec } from './message-spec.js'; +import { type MessageSpec, pushTypes } from './message-spec.js'; import { joinResult } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type CreateEntryMessageData, @@ -15,11 +15,12 @@ type RawCreateEntryMessageInfo, rawCreateEntryMessageInfoValidator, } from '../../types/messages/create-entry.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { prettyDate } from '../../utils/date-utils.js'; -import { ET, type EntityText } from '../../utils/entity-text.js'; +import { type EntityText, ET } from '../../utils/entity-text.js'; import { notifTextsForEntryCreationOrEdit } from '../notif-utils.js'; type CreateEntryMessageSpec = MessageSpec< @@ -119,7 +120,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { return notifTextsForEntryCreationOrEdit(messageInfos, threadInfo); }, diff --git a/lib/shared/messages/create-sidebar-message-spec.js b/lib/shared/messages/create-sidebar-message-spec.js --- a/lib/shared/messages/create-sidebar-message-spec.js +++ b/lib/shared/messages/create-sidebar-message-spec.js @@ -3,17 +3,17 @@ import invariant from 'invariant'; import { - pushTypes, type CreateMessageInfoParams, type MessageSpec, type NotificationTextsParams, + pushTypes, type RobotextParams, } from './message-spec.js'; import { joinResult } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type CreateSidebarMessageData, @@ -21,12 +21,13 @@ type RawCreateSidebarMessageInfo, rawCreateSidebarMessageInfoValidator, } from '../../types/messages/create-sidebar.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { - ET, type EntityText, + ET, pluralizeEntityText, } from '../../utils/entity-text.js'; import { notifTextsForSidebarCreation } from '../notif-utils.js'; @@ -173,7 +174,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, params: NotificationTextsParams, ): Promise { const createSidebarMessageInfo = messageInfos[0]; diff --git a/lib/shared/messages/create-sub-thread-message-spec.js b/lib/shared/messages/create-sub-thread-message-spec.js --- a/lib/shared/messages/create-sub-thread-message-spec.js +++ b/lib/shared/messages/create-sub-thread-message-spec.js @@ -3,17 +3,17 @@ import invariant from 'invariant'; import { - pushTypes, type CreateMessageInfoParams, - type MessageSpec, type GeneratesNotifsParams, + type MessageSpec, + pushTypes, } from './message-spec.js'; import { assertSingleMessageInfo } from './utils.js'; import { permissionLookup } from '../../permissions/thread-permissions.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type CreateSubthreadMessageData, @@ -21,12 +21,13 @@ type RawCreateSubthreadMessageInfo, rawCreateSubthreadMessageInfoValidator, } from '../../types/messages/create-subthread.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; import { threadPermissions } from '../../types/thread-permission-types.js'; import { threadTypes } from '../../types/thread-types-enum.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; -import { ET, type EntityText } from '../../utils/entity-text.js'; +import { type EntityText, ET } from '../../utils/entity-text.js'; import { notifTextsForSubthreadCreation } from '../notif-utils.js'; type CreateSubThreadMessageSpec = MessageSpec< @@ -140,7 +141,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/create-thread-message-spec.js b/lib/shared/messages/create-thread-message-spec.js --- a/lib/shared/messages/create-thread-message-spec.js +++ b/lib/shared/messages/create-thread-message-spec.js @@ -3,16 +3,16 @@ import invariant from 'invariant'; import { - pushTypes, type CreateMessageInfoParams, type MessageSpec, + pushTypes, type RobotextParams, } from './message-spec.js'; import { assertSingleMessageInfo } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type CreateThreadMessageData, @@ -20,12 +20,13 @@ type RawCreateThreadMessageInfo, rawCreateThreadMessageInfoValidator, } from '../../types/messages/create-thread.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { - ET, type EntityText, + ET, pluralizeEntityText, } from '../../utils/entity-text.js'; import { notifTextsForSubthreadCreation } from '../notif-utils.js'; @@ -157,7 +158,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/delete-entry-message-spec.js b/lib/shared/messages/delete-entry-message-spec.js --- a/lib/shared/messages/delete-entry-message-spec.js +++ b/lib/shared/messages/delete-entry-message-spec.js @@ -2,12 +2,12 @@ import invariant from 'invariant'; -import { pushTypes, type MessageSpec } from './message-spec.js'; +import { type MessageSpec, pushTypes } from './message-spec.js'; import { assertSingleMessageInfo } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type DeleteEntryMessageData, @@ -15,11 +15,12 @@ type RawDeleteEntryMessageInfo, rawDeleteEntryMessageInfoValidator, } from '../../types/messages/delete-entry.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { prettyDate } from '../../utils/date-utils.js'; -import { ET, type EntityText } from '../../utils/entity-text.js'; +import { type EntityText, ET } from '../../utils/entity-text.js'; type DeleteEntryMessageSpec = MessageSpec< DeleteEntryMessageData, @@ -118,7 +119,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/edit-entry-message-spec.js b/lib/shared/messages/edit-entry-message-spec.js --- a/lib/shared/messages/edit-entry-message-spec.js +++ b/lib/shared/messages/edit-entry-message-spec.js @@ -2,12 +2,12 @@ import invariant from 'invariant'; -import { pushTypes, type MessageSpec } from './message-spec.js'; +import { type MessageSpec, pushTypes } from './message-spec.js'; import { joinResult } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type EditEntryMessageData, @@ -15,11 +15,12 @@ type RawEditEntryMessageInfo, rawEditEntryMessageInfoValidator, } from '../../types/messages/edit-entry.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { prettyDate } from '../../utils/date-utils.js'; -import { ET, type EntityText } from '../../utils/entity-text.js'; +import { type EntityText, ET } from '../../utils/entity-text.js'; import { notifTextsForEntryCreationOrEdit } from '../notif-utils.js'; type EditEntryMessageSpec = MessageSpec< @@ -119,7 +120,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { return notifTextsForEntryCreationOrEdit(messageInfos, threadInfo); }, diff --git a/lib/shared/messages/join-thread-message-spec.js b/lib/shared/messages/join-thread-message-spec.js --- a/lib/shared/messages/join-thread-message-spec.js +++ b/lib/shared/messages/join-thread-message-spec.js @@ -6,8 +6,8 @@ import { joinResult } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type JoinThreadMessageData, @@ -15,12 +15,13 @@ type RawJoinThreadMessageInfo, rawJoinThreadMessageInfoValidator, } from '../../types/messages/join-thread.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { - ET, type EntityText, + ET, pluralizeEntityText, } from '../../utils/entity-text.js'; import { values } from '../../utils/objects.js'; @@ -89,7 +90,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const joinerArray: { [string]: RelativeUserInfo } = {}; for (const messageInfo of messageInfos) { diff --git a/lib/shared/messages/leave-thread-message-spec.js b/lib/shared/messages/leave-thread-message-spec.js --- a/lib/shared/messages/leave-thread-message-spec.js +++ b/lib/shared/messages/leave-thread-message-spec.js @@ -6,8 +6,8 @@ import { joinResult } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type LeaveThreadMessageData, @@ -15,12 +15,13 @@ type RawLeaveThreadMessageInfo, rawLeaveThreadMessageInfoValidator, } from '../../types/messages/leave-thread.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { - ET, type EntityText, + ET, pluralizeEntityText, } from '../../utils/entity-text.js'; import { values } from '../../utils/objects.js'; @@ -89,7 +90,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const leaverBeavers: { [string]: RelativeUserInfo } = {}; for (const messageInfo of messageInfos) { diff --git a/lib/shared/messages/message-spec.js b/lib/shared/messages/message-spec.js --- a/lib/shared/messages/message-spec.js +++ b/lib/shared/messages/message-spec.js @@ -5,22 +5,23 @@ import type { PlatformDetails } from '../../types/device-types.js'; import type { Media } from '../../types/media-types.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, RawComposableMessageInfo, RawMessageInfo, RawRobotextMessageInfo, } from '../../types/message-types.js'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo, UserInfo } from '../../types/user-types.js'; import type { EntityText } from '../../utils/entity-text.js'; import { type ParserRules } from '../markdown.js'; export type MessageTitleParam = { +messageInfo: Info, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +markdownRules: ParserRules, }; @@ -35,7 +36,7 @@ export type CreateMessageInfoParams = { +threadInfos: { - +[id: string]: ThreadInfo, + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, }, +createMessageInfoFromRaw: (rawInfo: RawMessageInfo) => ?MessageInfo, +createRelativeUserInfos: ( @@ -44,13 +45,13 @@ }; export type RobotextParams = { - +threadInfo: ?ThreadInfo, - +parentThreadInfo: ?ThreadInfo, + +threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, + +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; export type NotificationTextsParams = { +notifTargetUserInfo: UserInfo, - +parentThreadInfo: ?ThreadInfo, + +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; export type GeneratesNotifsParams = { @@ -67,8 +68,8 @@ export type CreationSideEffectsFunc = ( messageInfo: RawInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => Promise; export type MessageSpec = { @@ -99,7 +100,7 @@ ) => ?RawMessageInfo, +notificationTexts?: ( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, params: NotificationTextsParams, ) => Promise, +notificationCollapseKey?: ( diff --git a/lib/shared/messages/multimedia-message-spec.js b/lib/shared/messages/multimedia-message-spec.js --- a/lib/shared/messages/multimedia-message-spec.js +++ b/lib/shared/messages/multimedia-message-spec.js @@ -3,36 +3,36 @@ import invariant from 'invariant'; import { - pushTypes, type MessageSpec, type MessageTitleParam, + pushTypes, type RawMessageInfoFromServerDBRowParams, } from './message-spec.js'; import { joinResult } from './utils.js'; import { - versionSpecificMediaMessageFormat, - isMediaBlobServiceHosted, contentStringForMediaArray, + isMediaBlobServiceHosted, multimediaMessagePreview, + versionSpecificMediaMessageFormat, } from '../../media/media-utils.js'; import type { PlatformDetails } from '../../types/device-types.js'; import { assertMessageType, messageTypes, } from '../../types/message-types-enum.js'; -import { - isMediaMessageType, - rawMultimediaMessageInfoValidator, -} from '../../types/message-types.js'; import type { + ClientDBMessageInfo, MessageInfo, RawMessageInfo, - ClientDBMessageInfo, +} from '../../types/message-types.js'; +import { + isMediaMessageType, + rawMultimediaMessageInfoValidator, } from '../../types/message-types.js'; import type { ImagesMessageData, - RawImagesMessageInfo, ImagesMessageInfo, + RawImagesMessageInfo, } from '../../types/messages/images.js'; import type { MediaMessageData, @@ -41,8 +41,9 @@ } from '../../types/messages/media.js'; import { getMediaMessageServerDBContentsFromMedia } from '../../types/messages/media.js'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET } from '../../utils/entity-text.js'; import { @@ -311,7 +312,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const media = []; for (const messageInfo of messageInfos) { diff --git a/lib/shared/messages/reaction-message-spec.js b/lib/shared/messages/reaction-message-spec.js --- a/lib/shared/messages/reaction-message-spec.js +++ b/lib/shared/messages/reaction-message-spec.js @@ -3,10 +3,10 @@ import invariant from 'invariant'; import { - pushTypes, + type GeneratesNotifsParams, type MessageSpec, type MessageTitleParam, - type GeneratesNotifsParams, + pushTypes, } from './message-spec.js'; import { assertSingleMessageInfo, joinResult } from './utils.js'; import type { PlatformDetails } from '../../types/device-types.js'; @@ -15,18 +15,19 @@ messageTypes, } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { - type ReactionMessageData, type RawReactionMessageInfo, - type ReactionMessageInfo, rawReactionMessageInfoValidator, + type ReactionMessageData, + type ReactionMessageInfo, } from '../../types/messages/reaction.js'; import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET } from '../../utils/entity-text.js'; import { threadIsGroupChat } from '../thread-utils.js'; @@ -163,7 +164,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/remove-members-message-spec.js b/lib/shared/messages/remove-members-message-spec.js --- a/lib/shared/messages/remove-members-message-spec.js +++ b/lib/shared/messages/remove-members-message-spec.js @@ -10,21 +10,22 @@ import { joinResult } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type RawRemoveMembersMessageInfo, + rawRemoveMembersMessageInfoValidator, type RemoveMembersMessageData, type RemoveMembersMessageInfo, - rawRemoveMembersMessageInfoValidator, } from '../../types/messages/remove-members.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { - ET, type EntityText, + ET, pluralizeEntityText, } from '../../utils/entity-text.js'; import { values } from '../../utils/objects.js'; @@ -125,7 +126,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, params: NotificationTextsParams, ): Promise { const removedMembersObject: { [string]: RelativeUserInfo } = {}; diff --git a/lib/shared/messages/restore-entry-message-spec.js b/lib/shared/messages/restore-entry-message-spec.js --- a/lib/shared/messages/restore-entry-message-spec.js +++ b/lib/shared/messages/restore-entry-message-spec.js @@ -2,24 +2,25 @@ import invariant from 'invariant'; -import { pushTypes, type MessageSpec } from './message-spec.js'; +import { type MessageSpec, pushTypes } from './message-spec.js'; import { assertSingleMessageInfo } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type RawRestoreEntryMessageInfo, + rawRestoreEntryMessageInfoValidator, type RestoreEntryMessageData, type RestoreEntryMessageInfo, - rawRestoreEntryMessageInfoValidator, } from '../../types/messages/restore-entry.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { prettyDate } from '../../utils/date-utils.js'; -import { ET, type EntityText } from '../../utils/entity-text.js'; +import { type EntityText, ET } from '../../utils/entity-text.js'; type RestoreEntryMessageSpec = MessageSpec< RestoreEntryMessageData, @@ -118,7 +119,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); invariant( diff --git a/lib/shared/messages/text-message-spec.js b/lib/shared/messages/text-message-spec.js --- a/lib/shared/messages/text-message-spec.js +++ b/lib/shared/messages/text-message-spec.js @@ -4,10 +4,10 @@ import * as SimpleMarkdown from 'simple-markdown'; import { - pushTypes, type MessageSpec, - type RawMessageInfoFromServerDBRowParams, type NotificationTextsParams, + pushTypes, + type RawMessageInfoFromServerDBRowParams, } from './message-spec.js'; import { assertSingleMessageInfo, joinResult } from './utils.js'; import { @@ -16,26 +16,27 @@ } from '../../actions/thread-actions.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type RawTextMessageInfo, + rawTextMessageInfoValidator, type TextMessageData, type TextMessageInfo, - rawTextMessageInfoValidator, } from '../../types/messages/text.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; import { threadTypes } from '../../types/thread-types-enum.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; import { ET } from '../../utils/entity-text.js'; import { useDispatchActionPromise } from '../../utils/redux-promise-utils.js'; import { type ASTNode, type SingleASTNode, - stripSpoilersFromNotifications, stripSpoilersFromMarkdownAST, + stripSpoilersFromNotifications, } from '../markdown.js'; import { isUserMentioned, @@ -43,8 +44,8 @@ } from '../mention-utils.js'; import { notifTextsForSidebarCreation } from '../notif-utils.js'; import { - threadIsGroupChat, extractNewMentionedParentMembers, + threadIsGroupChat, } from '../thread-utils.js'; /** @@ -198,7 +199,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, params: NotificationTextsParams, ): Promise { // We special-case sidebarCreations. Usually we don't send any notifs in @@ -294,8 +295,8 @@ const callChangeThreadSettings = useChangeThreadSettings(); return async ( messageInfo: RawTextMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => { if (threadInfo.type !== threadTypes.SIDEBAR) { return; diff --git a/lib/shared/messages/update-relationship-message-spec.js b/lib/shared/messages/update-relationship-message-spec.js --- a/lib/shared/messages/update-relationship-message-spec.js +++ b/lib/shared/messages/update-relationship-message-spec.js @@ -3,26 +3,27 @@ import invariant from 'invariant'; import { - pushTypes, type CreateMessageInfoParams, type MessageSpec, + pushTypes, } from './message-spec.js'; import { assertSingleMessageInfo } from './utils.js'; import { messageTypes } from '../../types/message-types-enum.js'; import type { - MessageInfo, ClientDBMessageInfo, + MessageInfo, } from '../../types/message-types.js'; import { type RawUpdateRelationshipMessageInfo, + rawUpdateRelationshipMessageInfoValidator, type UpdateRelationshipMessageData, type UpdateRelationshipMessageInfo, - rawUpdateRelationshipMessageInfoValidator, } from '../../types/messages/update-relationship.js'; +import type { MinimallyEncodedThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts } from '../../types/notif-types.js'; -import type { ThreadInfo } from '../../types/thread-types.js'; +import type { LegacyThreadInfo } from '../../types/thread-types.js'; import type { RelativeUserInfo } from '../../types/user-types.js'; -import { ET, type EntityText } from '../../utils/entity-text.js'; +import { type EntityText, ET } from '../../utils/entity-text.js'; type UpdateRelationshipMessageSpec = MessageSpec< UpdateRelationshipMessageData, @@ -148,7 +149,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const messageInfo = assertSingleMessageInfo(messageInfos); const creator = ET.user({ userInfo: messageInfo.creator }); diff --git a/lib/shared/notif-utils.js b/lib/shared/notif-utils.js --- a/lib/shared/notif-utils.js +++ b/lib/shared/notif-utils.js @@ -9,24 +9,25 @@ import { threadNoun } from './thread-utils.js'; import { type MessageType, messageTypes } from '../types/message-types-enum.js'; import { + type MessageData, type MessageInfo, type RawMessageInfo, type RobotextMessageInfo, - type MessageData, type SidebarSourceMessageInfo, } from '../types/message-types.js'; import type { CreateSidebarMessageInfo } from '../types/messages/create-sidebar.js'; import type { TextMessageInfo } from '../types/messages/text.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { NotifTexts, ResolvedNotifTexts } from '../types/notif-types.js'; import { type ThreadType, threadTypes } from '../types/thread-types-enum.js'; -import type { ThreadInfo } from '../types/thread-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import type { RelativeUserInfo, UserInfo } from '../types/user-types.js'; import { prettyDate } from '../utils/date-utils.js'; import type { GetENSNames } from '../utils/ens-helpers.js'; import { + type EntityText, ET, getEntityTextAsString, - type EntityText, type ThreadEntity, } from '../utils/entity-text.js'; import { promiseAll } from '../utils/promises.js'; @@ -34,8 +35,8 @@ async function notifTextsForMessageInfo( messageInfos: MessageInfo[], - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, notifTargetUserInfo: UserInfo, getENSNames: ?GetENSNames, ): Promise { @@ -61,7 +62,7 @@ function notifTextsForEntryCreationOrEdit( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): NotifTexts { const hasCreateEntry = messageInfos.some( messageInfo => messageInfo.type === messageTypes.CREATE_ENTRY, @@ -108,7 +109,7 @@ type NotifTextsForSubthreadCreationInput = { +creator: RelativeUserInfo, +threadType: ThreadType, - +parentThreadInfo: ThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +childThreadName: ?string, +childThreadUIName: string | ThreadEntity, }; @@ -150,7 +151,7 @@ +createSidebarMessageInfo: CreateSidebarMessageInfo, +sidebarSourceMessageInfo?: ?SidebarSourceMessageInfo, +firstSidebarMessageInfo?: ?TextMessageInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +params: NotificationTextsParams, }; function notifTextsForSidebarCreation( @@ -214,8 +215,8 @@ async function fullNotifTextsForMessageInfo( messageInfos: $ReadOnlyArray, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, notifTargetUserInfo: UserInfo, getENSNames: ?GetENSNames, ): Promise { @@ -265,8 +266,8 @@ function notifRobotextForMessageInfo( messageInfo: RobotextMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): EntityText { const robotext = robotextForMessageInfo( messageInfo, diff --git a/lib/shared/reaction-utils.js b/lib/shared/reaction-utils.js --- a/lib/shared/reaction-utils.js +++ b/lib/shared/reaction-utils.js @@ -9,11 +9,12 @@ import { useENSNames } from '../hooks/ens-cache.js'; import type { ReactionInfo } from '../selectors/chat-selectors.js'; import type { - RobotextMessageInfo, ComposableMessageInfo, + RobotextMessageInfo, } from '../types/message-types.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; -import type { ThreadInfo } from '../types/thread-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import { useSelector } from '../utils/redux-utils.js'; function useViewerAlreadySelectedMessageReactions( @@ -74,7 +75,7 @@ } function useCanCreateReactionFromMessage( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, targetMessageInfo: ComposableMessageInfo | RobotextMessageInfo, ): boolean { const targetMessageCreatorRelationship = useSelector( diff --git a/lib/shared/search-utils.js b/lib/shared/search-utils.js --- a/lib/shared/search-utils.js +++ b/lib/shared/search-utils.js @@ -5,13 +5,13 @@ import { messageID } from './message-utils.js'; import SearchIndex from './search-index.js'; import { - userIsMember, - threadMemberHasPermission, getContainingThreadID, + threadMemberHasPermission, + userIsMember, } from './thread-utils.js'; import { - useSearchMessages as useSearchMessagesAction, searchMessagesActionTypes, + useSearchMessages as useSearchMessagesAction, } from '../actions/message-actions.js'; import { searchUsers, @@ -26,14 +26,15 @@ import { useUserSearchIndex } from '../selectors/nav-selectors.js'; import { relationshipBlockedInEitherDirection } from '../shared/relationship-utils.js'; import type { MessageInfo, RawMessageInfo } from '../types/message-types.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from '../types/relationship-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; import { type ThreadType, threadTypes } from '../types/thread-types-enum.js'; -import { type ThreadInfo } from '../types/thread-types.js'; +import type { LegacyThreadInfo } from '../types/thread-types.js'; import type { AccountUserInfo, - UserListItem, GlobalAccountUserInfo, + UserListItem, } from '../types/user-types.js'; import { useServerCall } from '../utils/action-utils.js'; import { isValidENSName } from '../utils/ens-helpers.js'; @@ -60,9 +61,9 @@ }, +excludeUserIDs: $ReadOnlyArray, +userInfo: AccountUserInfo | GlobalAccountUserInfo, - +parentThreadInfo: ?ThreadInfo, - +communityThreadInfo: ?ThreadInfo, - +containingThreadInfo: ?ThreadInfo, + +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, + +communityThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, + +containingThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }) { const { id } = userInfo; if (excludeUserIDs.includes(id) || id in results) { @@ -98,8 +99,8 @@ +userInfos: { +[id: string]: AccountUserInfo }, +excludeUserIDs: $ReadOnlyArray, +includeServerSearchUsers?: $ReadOnlyArray, - +inputParentThreadInfo?: ?ThreadInfo, - +inputCommunityThreadInfo?: ?ThreadInfo, + +inputParentThreadInfo?: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, + +inputCommunityThreadInfo?: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +threadType?: ?ThreadType, }): UserListItem[] { const memoizedUserInfos = React.useMemo(() => values(userInfos), [userInfos]); diff --git a/lib/shared/user-utils.js b/lib/shared/user-utils.js --- a/lib/shared/user-utils.js +++ b/lib/shared/user-utils.js @@ -2,8 +2,14 @@ import { memberHasAdminPowers } from './thread-utils.js'; import { useENSNames } from '../hooks/ens-cache.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; -import type { ServerThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + ServerThreadInfo, +} from '../types/thread-types.js'; import type { UserInfo } from '../types/user-types.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -30,7 +36,11 @@ } function useKeyserverAdmin( - community: ThreadInfo | RawThreadInfo | ServerThreadInfo, + community: + | LegacyThreadInfo + | MinimallyEncodedThreadInfo + | RawThreadInfo + | ServerThreadInfo, ): ?UserInfo { const userInfos = useSelector(state => state.userStore.userInfos); // This hack only works as long as there is only one admin 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,8 @@ import { tID, tNumber, tShape } from '../../utils/validation-utils.js'; import { messageTypes } from '../message-types-enum.js'; -import type { ThreadInfo } from '../thread-types.js'; +import type { MinimallyEncodedThreadInfo } from '../minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from '../thread-types.js'; import type { RelativeUserInfo } from '../user-types.js'; export type CreateSidebarMessageData = { @@ -51,7 +52,7 @@ +sourceMessageAuthor: RelativeUserInfo, +initialThreadState: { +name: ?string, - +parentThreadInfo: ThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +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,8 @@ import { tID, tNumber, tShape } from '../../utils/validation-utils.js'; import { messageTypes } from '../message-types-enum.js'; -import type { ThreadInfo } from '../thread-types.js'; +import type { MinimallyEncodedThreadInfo } from '../minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from '../thread-types.js'; import type { RelativeUserInfo } from '../user-types.js'; export type CreateSubthreadMessageData = { @@ -36,5 +37,5 @@ threadID: string, creator: RelativeUserInfo, time: number, - childThreadInfo: ThreadInfo, + childThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; 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 @@ -6,12 +6,13 @@ import { tID, tNumber, - tShape, tNumEnum, + tShape, } from '../../utils/validation-utils.js'; import { messageTypes } from '../message-types-enum.js'; -import { threadTypes, type ThreadType } from '../thread-types-enum.js'; -import type { ThreadInfo } from '../thread-types.js'; +import type { MinimallyEncodedThreadInfo } from '../minimally-encoded-thread-permissions-types.js'; +import { type ThreadType, threadTypes } from '../thread-types-enum.js'; +import type { LegacyThreadInfo } from '../thread-types.js'; import type { RelativeUserInfo } from '../user-types.js'; export type CreateThreadMessageData = { @@ -58,7 +59,7 @@ initialThreadState: { type: ThreadType, name: ?string, - parentThreadInfo: ?ThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, color: string, otherMembers: RelativeUserInfo[], }, 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 @@ -4,12 +4,18 @@ import { values } from './objects.js'; import { threadInFilterList, threadIsChannel } from '../shared/thread-utils.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import { communitySubthreads } from '../types/thread-types-enum.js'; -import type { ResolvedThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { + LegacyThreadInfo, + ResolvedThreadInfo, +} from '../types/thread-types.js'; type WritableCommunityDrawerItemData = { - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, itemChildren: $ReadOnlyArray>, hasSubchannelsButton: boolean, labelStyle: T, @@ -20,7 +26,9 @@ function createRecursiveDrawerItemsData( childThreadInfosMap: { - +[id: string]: $ReadOnlyArray, + +[id: string]: $ReadOnlyArray< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + >, }, communities: $ReadOnlyArray, labelStyles: $ReadOnlyArray, @@ -60,9 +68,11 @@ } function threadHasSubchannels( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, childThreadInfosMap: { - +[id: string]: $ReadOnlyArray, + +[id: string]: $ReadOnlyArray< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + >, }, ): boolean { if (!childThreadInfosMap[threadInfo.id]?.length) { @@ -101,7 +111,10 @@ function filterThreadIDsBelongingToCommunity( communityID: string, threadInfosObj: { - +[id: string]: RawThreadInfo | ThreadInfo, + +[id: string]: + | RawThreadInfo + | LegacyThreadInfo + | MinimallyEncodedThreadInfo, }, ): $ReadOnlySet { const threadInfos = values(threadInfosObj); 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 @@ -4,16 +4,20 @@ import * as React from 'react'; import { + entityTextToRawString, ET, useENSNamesForEntityText, - entityTextToRawString, } from './entity-text.js'; import type { UseENSNamesOptions } from '../hooks/ens-cache.js'; -import type { ThreadInfo, ResolvedThreadInfo } from '../types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + ResolvedThreadInfo, +} from '../types/thread-types.js'; import { values } from '../utils/objects.js'; function useResolvedThreadInfos( - threadInfos: $ReadOnlyArray, + threadInfos: $ReadOnlyArray, options?: ?UseENSNamesOptions, ): $ReadOnlyArray { const entityText = React.useMemo( @@ -52,7 +56,7 @@ } function useResolvedOptionalThreadInfos( - threadInfos: ?$ReadOnlyArray, + threadInfos: ?$ReadOnlyArray, ): ?$ReadOnlyArray { const entityText = React.useMemo(() => { if (!threadInfos) { @@ -87,7 +91,9 @@ } function useResolvedThreadInfosObj( - threadInfosObj: { +[id: string]: ThreadInfo }, + threadInfosObj: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, options?: ?UseENSNamesOptions, ): { +[id: string]: ResolvedThreadInfo, @@ -111,14 +117,16 @@ }, [resolvedThreadInfosArray]); } -function useResolvedThreadInfo(threadInfo: ThreadInfo): ResolvedThreadInfo { +function useResolvedThreadInfo( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +): ResolvedThreadInfo { const resolutionInput = React.useMemo(() => [threadInfo], [threadInfo]); const [resolvedThreadInfo] = useResolvedThreadInfos(resolutionInput); return resolvedThreadInfo; } function useResolvedOptionalThreadInfo( - threadInfo: ?ThreadInfo, + threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): ?ResolvedThreadInfo { const resolutionInput = React.useMemo( () => (threadInfo ? [threadInfo] : []), diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js --- a/lib/utils/entity-text.js +++ b/lib/utils/entity-text.js @@ -9,13 +9,19 @@ import { useENSNames, type UseENSNamesOptions } from '../hooks/ens-cache.js'; import { threadNoun } from '../shared/thread-utils.js'; import { stringForUser } from '../shared/user-utils.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import { type ThreadType, threadTypes, threadTypeValidator, } from '../types/thread-types-enum.js'; -import type { LegacyRawThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { + LegacyRawThreadInfo, + LegacyThreadInfo, +} from '../types/thread-types.js'; import { basePluralize } from '../utils/text-utils.js'; export type UserEntity = { @@ -135,17 +141,25 @@ type EntityTextThreadInput = | { +display: 'uiName', - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, } | { +display?: 'shortName', - +threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, + +threadInfo: + | LegacyRawThreadInfo + | RawThreadInfo + | LegacyThreadInfo + | MinimallyEncodedThreadInfo, +subchannel?: ?boolean, +possessive?: ?boolean, } | { +display: 'alwaysDisplayShortName', - +threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, + +threadInfo: + | LegacyRawThreadInfo + | RawThreadInfo + | LegacyThreadInfo + | MinimallyEncodedThreadInfo, +possessive?: ?boolean, } | { diff --git a/lib/utils/message-pinning-utils.js b/lib/utils/message-pinning-utils.js --- a/lib/utils/message-pinning-utils.js +++ b/lib/utils/message-pinning-utils.js @@ -2,14 +2,24 @@ import { isInvalidPinSourceForThread } from '../shared/message-utils.js'; import { threadHasPermission } from '../shared/thread-utils.js'; -import type { RawMessageInfo, MessageInfo } from '../types/message-types.js'; -import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { MessageInfo, RawMessageInfo } from '../types/message-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; -import type { LegacyRawThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { + LegacyRawThreadInfo, + LegacyThreadInfo, +} from '../types/thread-types.js'; function canToggleMessagePin( messageInfo: RawMessageInfo | MessageInfo, - threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, + threadInfo: + | LegacyRawThreadInfo + | RawThreadInfo + | LegacyThreadInfo + | MinimallyEncodedThreadInfo, ): boolean { const isValidMessage = !isInvalidPinSourceForThread(messageInfo, threadInfo); const hasManagePinsPermission = threadHasPermission( diff --git a/lib/utils/role-utils.js b/lib/utils/role-utils.js --- a/lib/utils/role-utils.js +++ b/lib/utils/role-utils.js @@ -4,15 +4,16 @@ import { useSelector } from './redux-utils.js'; import { threadInfoSelector } from '../selectors/thread-selectors.js'; +import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { configurableCommunityPermissions, type ThreadRolePermissionsBlob, type UserSurfacedPermission, } from '../types/thread-permission-types.js'; import type { - RoleInfo, + LegacyThreadInfo, RelativeMemberInfo, - ThreadInfo, + RoleInfo, } from '../types/thread-types'; import { threadTypes } from '../types/thread-types-enum.js'; @@ -56,7 +57,7 @@ } function useRolesFromCommunityThreadInfo( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, memberInfos: $ReadOnlyArray, ): $ReadOnlyMap { // Our in-code system has chat-specific roles, while the diff --git a/native/avatars/edit-thread-avatar.react.js b/native/avatars/edit-thread-avatar.react.js --- a/native/avatars/edit-thread-avatar.react.js +++ b/native/avatars/edit-thread-avatar.react.js @@ -6,8 +6,11 @@ import { ActivityIndicator, TouchableOpacity, View } from 'react-native'; import { EditThreadAvatarContext } from 'lib/components/base-edit-thread-avatar-provider.react.js'; -import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useNativeSetThreadAvatar, @@ -23,7 +26,7 @@ import { useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: RawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, +disabled?: boolean, }; function EditThreadAvatar(props: Props): React.Node { 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 @@ -8,15 +8,25 @@ } from 'lib/shared/avatar-utils.js'; import { getSingleOtherUser } from 'lib/shared/thread-utils.js'; import type { AvatarSize } from 'lib/types/avatar-types.js'; -import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ResolvedThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { + LegacyThreadInfo, + ResolvedThreadInfo, +} from 'lib/types/thread-types.js'; import Avatar from './avatar.react.js'; import { useSelector } from '../redux/redux-utils.js'; type Props = { - +threadInfo: RawThreadInfo | ThreadInfo | ResolvedThreadInfo, + +threadInfo: + | RawThreadInfo + | LegacyThreadInfo + | MinimallyEncodedThreadInfo + | ResolvedThreadInfo, +size: AvatarSize, }; 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 @@ -11,49 +11,50 @@ import _throttle from 'lodash/throttle.js'; import * as React from 'react'; import { - View, - Text, - FlatList, AppState as NativeAppState, - Platform, + FlatList, LayoutAnimation, + Platform, + Text, TouchableWithoutFeedback, + View, } from 'react-native'; +import type { UpdateCalendarQueryInput } from 'lib/actions/entry-actions.js'; import { updateCalendarQueryActionTypes, useUpdateCalendarQuery, } from 'lib/actions/entry-actions.js'; -import type { UpdateCalendarQueryInput } from 'lib/actions/entry-actions.js'; import { connectionSelector } from 'lib/selectors/keyserver-selectors.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { entryKey } from 'lib/shared/entry-utils.js'; import type { - EntryInfo, CalendarQuery, CalendarQueryUpdateResult, + EntryInfo, } from 'lib/types/entry-types.js'; import type { CalendarFilter } from 'lib/types/filter-types.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ConnectionStatus } from 'lib/types/socket-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { + dateFromString, dateString, prettyDate, - dateFromString, } from 'lib/utils/date-utils.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import sleep from 'lib/utils/sleep.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import CalendarInputBar from './calendar-input-bar.react.js'; import { + dummyNodeForEntryHeightMeasurement, Entry, InternalEntry, - dummyNodeForEntryHeightMeasurement, } from './entry.react.js'; import SectionFooter from './section-footer.react.js'; import ContentLoading from '../components/content-loading.react.js'; @@ -61,46 +62,46 @@ import ListLoadingIndicator from '../components/list-loading-indicator.react.js'; import NodeHeightMeasurer from '../components/node-height-measurer.react.js'; import { - addKeyboardShowListener, addKeyboardDismissListener, + addKeyboardShowListener, removeKeyboardListener, } from '../keyboard/keyboard.js'; import DisconnectedBar from '../navigation/disconnected-bar.react.js'; import { - createIsForegroundSelector, createActiveTabSelector, + createIsForegroundSelector, } from '../navigation/nav-selectors.js'; import { NavContext } from '../navigation/navigation-context.js'; +import type { NavigationRoute } from '../navigation/route-names.js'; import { CalendarRouteName, ThreadPickerModalRouteName, } from '../navigation/route-names.js'; -import type { NavigationRoute } from '../navigation/route-names.js'; import type { TabNavigationProp } from '../navigation/tab-navigator.react.js'; import { useSelector } from '../redux/redux-utils.js'; -import { calendarListData } from '../selectors/calendar-selectors.js'; import type { CalendarItem, - SectionHeaderItem, - SectionFooterItem, LoaderItem, + SectionFooterItem, + SectionHeaderItem, } from '../selectors/calendar-selectors.js'; +import { calendarListData } from '../selectors/calendar-selectors.js'; import { type DerivedDimensionsInfo, derivedDimensionsInfoSelector, } from '../selectors/dimensions-selectors.js'; import { - useColors, - useStyles, - useIndicatorStyle, type Colors, type IndicatorStyle, + useColors, + useIndicatorStyle, + useStyles, } from '../themes/colors.js'; import type { EventSubscription, + KeyboardEvent, ScrollEvent, ViewableItemsChange, - KeyboardEvent, } from '../types/react-native.js'; export type EntryInfoWithHeight = { @@ -114,7 +115,7 @@ | { itemType: 'entryInfo', entryInfo: EntryInfoWithHeight, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; 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 @@ -6,25 +6,25 @@ import _omit from 'lodash/fp/omit.js'; import * as React from 'react'; import { - View, + Keyboard, + LayoutAnimation, + Platform, Text, TextInput as BaseTextInput, - Platform, TouchableWithoutFeedback, - LayoutAnimation, - Keyboard, + View, } from 'react-native'; import shallowequal from 'shallowequal'; import tinycolor from 'tinycolor2'; import { + concurrentModificationResetActionType, createEntryActionTypes, - useCreateEntry, - saveEntryActionTypes, - useSaveEntry, deleteEntryActionTypes, + saveEntryActionTypes, + useCreateEntry, useDeleteEntry, - concurrentModificationResetActionType, + useSaveEntry, } from 'lib/actions/entry-actions.js'; import { registerFetchKey } from 'lib/reducers/loading-reducer.js'; import { connectionSelector } from 'lib/selectors/keyserver-selectors.js'; @@ -32,25 +32,29 @@ import { entryKey } from 'lib/shared/entry-utils.js'; import { threadHasPermission } from 'lib/shared/thread-utils.js'; import type { + CalendarQuery, CreateEntryInfo, - SaveEntryInfo, - SaveEntryResult, - SaveEntryPayload, CreateEntryPayload, DeleteEntryInfo, DeleteEntryResult, - CalendarQuery, + SaveEntryInfo, + SaveEntryPayload, + SaveEntryResult, } from 'lib/types/entry-types.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; +import type { MinimallyEncodedThreadInfo } 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, ThreadInfo } from 'lib/types/thread-types.js'; +import type { + LegacyThreadInfo, + ResolvedThreadInfo, +} 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 sleep from 'lib/utils/sleep.js'; @@ -187,7 +191,7 @@ }; type BaseProps = { ...SharedProps, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { ...SharedProps, 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 @@ -2,10 +2,11 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; -import { ChatContext } from './chat-context.js'; import type { SidebarAnimationType } from './chat-context.js'; +import { ChatContext } from './chat-context.js'; import ChatItemHeightMeasurer from './chat-item-height-measurer.react.js'; import type { NativeChatMessageItem } from './message-data.react.js'; import type { ChatMessageItemWithHeight } from '../types/chat-types.js'; @@ -16,7 +17,7 @@ export type MeasurementTask = { +messages: $ReadOnlyArray, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +onMessagesMeasured: ( messagesWithHeight: $ReadOnlyArray, measuredHeights: $ReadOnlyMap, @@ -37,7 +38,7 @@ const measureMessages = React.useCallback( ( messages: ?$ReadOnlyArray, - threadInfo: ?ThreadInfo, + threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, onMessagesMeasured: ($ReadOnlyArray) => mixed, measurerID: number, ) => { @@ -93,7 +94,7 @@ return { measure: ( messages: ?$ReadOnlyArray, - threadInfo: ?ThreadInfo, + threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, 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 @@ -4,14 +4,15 @@ import * as React from 'react'; import type { SetState } from 'lib/types/hook-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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, - ?ThreadInfo, + ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ($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 @@ -6,14 +6,14 @@ import _throttle from 'lodash/throttle.js'; import * as React from 'react'; import { - View, - TextInput, - TouchableOpacity, + ActivityIndicator, + NativeAppEventEmitter, Platform, Text, - ActivityIndicator, + TextInput, + TouchableOpacity, TouchableWithoutFeedback, - NativeAppEventEmitter, + View, } from 'react-native'; import { TextInputKeyboardMangerIOS } from 'react-native-keyboard-input'; import Animated, { @@ -28,8 +28,8 @@ } from 'lib/actions/draft-actions.js'; import { joinThreadActionTypes, - useJoinThread, newThreadActionTypes, + useJoinThread, } from 'lib/actions/thread-actions.js'; import { useChatMentionContext, @@ -40,29 +40,29 @@ import { colorIsDark } from 'lib/shared/color-utils.js'; import { useEditMessage } from 'lib/shared/edit-messages-utils.js'; import { - useMentionTypeaheadUserSuggestions, - useMentionTypeaheadChatSuggestions, getTypeaheadRegexMatches, - type Selection, - useUserMentionsCandidates, type MentionTypeaheadSuggestionItem, + type Selection, type TypeaheadMatchedStrings, + useMentionTypeaheadChatSuggestions, + useMentionTypeaheadUserSuggestions, + useUserMentionsCandidates, } from 'lib/shared/mention-utils.js'; import { - useNextLocalID, - trimMessage, - useMessagePreview, messageKey, type MessagePreviewResult, + trimMessage, + useMessagePreview, + useNextLocalID, } from 'lib/shared/message-utils.js'; import SentencePrefixSearchIndex from 'lib/shared/sentence-prefix-search-index.js'; import { - threadHasPermission, - viewerIsMember, - threadFrozenDueToViewerBlock, - threadActualMembers, checkIfDefaultMembersAreVoiced, draftKeyFromThreadID, + threadActualMembers, + threadFrozenDueToViewerBlock, + threadHasPermission, + viewerIsMember, } from 'lib/shared/thread-utils.js'; import type { CalendarQuery } from 'lib/types/entry-types.js'; import type { SetState } from 'lib/types/hook-types.js'; @@ -70,22 +70,23 @@ import type { PhotoPaste } from 'lib/types/media-types.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import type { - SendEditMessageResponse, MessageInfo, + SendEditMessageResponse, } from 'lib/types/message-types.js'; +import type { MinimallyEncodedThreadInfo } 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 { - ClientThreadJoinRequest, - ThreadJoinPayload, ChatMentionCandidates, + ClientThreadJoinRequest, + LegacyThreadInfo, RelativeMemberInfo, - ThreadInfo, + ThreadJoinPayload, } from 'lib/types/thread-types.js'; import { type UserInfos } from 'lib/types/user-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; @@ -107,43 +108,43 @@ import SingleLine from '../components/single-line.react.js'; import SWMansionIcon from '../components/swmansion-icon.react.js'; import { + type EditInputBarMessageParameters, type InputState, InputStateContext, - type EditInputBarMessageParameters, } from '../input/input-state.js'; import KeyboardInputHost from '../keyboard/keyboard-input-host.react.js'; import { - type KeyboardState, KeyboardContext, + type KeyboardState, } from '../keyboard/keyboard-state.js'; import { getKeyboardHeight } from '../keyboard/keyboard.js'; import { getDefaultTextMessageRules } from '../markdown/rules.react.js'; import { - nonThreadCalendarQuery, activeThreadSelector, + nonThreadCalendarQuery, } from '../navigation/nav-selectors.js'; import { NavContext } from '../navigation/navigation-context.js'; -import { OverlayContext } from '../navigation/overlay-context.js'; import type { OverlayContextType } from '../navigation/overlay-context.js'; +import { OverlayContext } from '../navigation/overlay-context.js'; import { - type NavigationRoute, ChatCameraModalRouteName, ImagePasteModalRouteName, + type NavigationRoute, } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; -import { type Colors, useStyles, useColors } from '../themes/colors.js'; -import type { LayoutEvent, ImagePasteEvent } from '../types/react-native.js'; +import { type Colors, useColors, useStyles } from '../themes/colors.js'; +import type { ImagePasteEvent, LayoutEvent } from '../types/react-native.js'; import { - type AnimatedViewStyle, AnimatedView, + type AnimatedViewStyle, type ViewStyle, } from '../types/styles.js'; import Alert from '../utils/alert.js'; import { runTiming } from '../utils/animation-utils.js'; import { exitEditAlert } from '../utils/edit-messages-utils.js'; import { - nativeMentionTypeaheadRegex, mentionTypeaheadTooltipActions, + nativeMentionTypeaheadRegex, } from '../utils/typeahead-utils.js'; const { Value, Clock, block, set, cond, neq, sub, interpolateNode, stopClock } = @@ -273,7 +274,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { ...BaseProps, @@ -297,7 +298,7 @@ +userMentionsCandidates: $ReadOnlyArray, +chatMentionSearchIndex: SentencePrefixSearchIndex, +chatMentionCandidates: ChatMentionCandidates, - +parentThreadInfo: ?ThreadInfo, + +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +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 @@ -1,29 +1,30 @@ // @flow import type { - StackAction, + GenericNavigationAction, Route, Router, - StackRouterOptions, - StackNavigationState, RouterConfigOptions, - GenericNavigationAction, + StackAction, + StackNavigationState, + StackRouterOptions, } from '@react-navigation/core'; -import { StackRouter, CommonActions } from '@react-navigation/native'; +import { CommonActions, StackRouter } from '@react-navigation/native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 { clearScreensActionType, - replaceWithThreadActionType, clearThreadsActionType, pushNewThreadActionType, + replaceWithThreadActionType, } from '../navigation/action-types.js'; import { getRemoveEditMode } from '../navigation/nav-selectors.js'; import { - removeScreensFromStack, getThreadIDFromRoute, + removeScreensFromStack, } from '../navigation/navigation-utils.js'; import { ChatThreadListRouteName, @@ -39,7 +40,7 @@ type ReplaceWithThreadAction = { +type: 'REPLACE_WITH_THREAD', +payload: { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }, }; type ClearThreadsAction = { @@ -51,7 +52,7 @@ type PushNewThreadAction = { +type: 'PUSH_NEW_THREAD', +payload: { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }, }; export type ChatRouterNavigationAction = @@ -63,9 +64,13 @@ export type ChatRouterNavigationHelpers = { +clearScreens: (routeNames: $ReadOnlyArray) => void, - +replaceWithThread: (threadInfo: ThreadInfo) => void, + +replaceWithThread: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, +clearThreads: (threadIDs: $ReadOnlyArray) => void, - +pushNewThread: (threadInfo: ThreadInfo) => void, + +pushNewThread: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, }; function ChatRouter( @@ -159,7 +164,9 @@ routeNames, }, }), - replaceWithThread: (threadInfo: ThreadInfo) => + replaceWithThread: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => ({ type: replaceWithThreadActionType, payload: { threadInfo }, @@ -168,7 +175,9 @@ type: clearThreadsActionType, payload: { threadIDs }, }), - pushNewThread: (threadInfo: ThreadInfo) => + pushNewThread: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => ({ 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 @@ -4,7 +4,8 @@ import { Text, View } from 'react-native'; import type { ChatThreadItem } from 'lib/selectors/chat-selectors.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -23,11 +24,15 @@ type Props = { +data: ChatThreadItem, +onPressItem: ( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, pendingPersonalThreadUserInfo?: UserInfo, ) => void, - +onPressSeeMoreSidebars: (threadInfo: ThreadInfo) => void, - +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void, + +onPressSeeMoreSidebars: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, + +onSwipeableWillOpen: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => 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 @@ -4,16 +4,17 @@ import * as React from 'react'; import { Text } from 'react-native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +unread: boolean, - +onPress: (threadInfo: ThreadInfo) => void, + +onPress: (threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo) => 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 @@ -3,9 +3,10 @@ import * as React from 'react'; import { View } from 'react-native'; -import type { SidebarInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo, SidebarInfo } from 'lib/types/thread-types.js'; -import { SidebarItem, sidebarHeight } from './sidebar-item.react.js'; +import { sidebarHeight, SidebarItem } from './sidebar-item.react.js'; import SwipeableThread from './swipeable-thread.react.js'; import Button from '../components/button.react.js'; import UnreadDot from '../components/unread-dot.react.js'; @@ -15,8 +16,12 @@ type Props = { +sidebarInfo: SidebarInfo, - +onPressItem: (threadInfo: ThreadInfo) => void, - +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void, + +onPressItem: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, + +onSwipeableWillOpen: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => 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 @@ -2,22 +2,22 @@ import IonIcon from '@expo/vector-icons/Ionicons.js'; import type { - TabNavigationState, - BottomTabOptions, BottomTabNavigationEventMap, + BottomTabOptions, + StackNavigationEventMap, StackNavigationState, StackOptions, - StackNavigationEventMap, + TabNavigationState, } from '@react-navigation/core'; import invariant from 'invariant'; import * as React from 'react'; import { - View, + BackHandler, FlatList, Platform, - TouchableWithoutFeedback, - BackHandler, TextInput, + TouchableWithoutFeedback, + View, } from 'react-native'; import { FloatingAction } from 'react-native-floating-action'; @@ -31,24 +31,25 @@ getThreadListSearchResults, useThreadListSearch, } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { UserInfo } from 'lib/types/user-types.js'; import { ChatThreadListItem } from './chat-thread-list-item.react.js'; import ChatThreadListSearch from './chat-thread-list-search.react.js'; import { getItemLayout, keyExtractor } from './chat-thread-list-utils.js'; import type { - ChatTopTabsNavigationProp, ChatNavigationProp, + ChatTopTabsNavigationProp, } from './chat.react.js'; import { useNavigateToThread } from './message-list-types.js'; import { - SidebarListModalRouteName, - HomeChatThreadListRouteName, BackgroundChatThreadListRouteName, + HomeChatThreadListRouteName, type NavigationRoute, type ScreenParamList, + SidebarListModalRouteName, } from '../navigation/route-names.js'; import type { TabNavigationProp } from '../navigation/tab-navigator.react.js'; import { useSelector } from '../redux/redux-utils.js'; @@ -76,7 +77,9 @@ +route: | NavigationRoute<'HomeChatThreadList'> | NavigationRoute<'BackgroundChatThreadList'>, - +filterThreads: (threadItem: ThreadInfo) => boolean, + +filterThreads: ( + threadItem: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => boolean, +emptyItem?: React.ComponentType<{}>, }; export type SearchStatus = 'inactive' | 'activating' | 'active'; @@ -126,7 +129,8 @@ ); const onSwipeableWillOpen = React.useCallback( - (threadInfo: ThreadInfo) => setOpenedSwipeableID(threadInfo.id), + (threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo) => + setOpenedSwipeableID(threadInfo.id), [], ); @@ -175,7 +179,10 @@ const searchInputRef = React.useRef>(); const onPressItem = React.useCallback( - (threadInfo: ThreadInfo, pendingPersonalThreadUserInfo?: UserInfo) => { + ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + pendingPersonalThreadUserInfo?: UserInfo, + ) => { onChangeSearchText(''); if (searchInputRef.current) { searchInputRef.current.blur(); @@ -186,7 +193,7 @@ ); const onPressSeeMoreSidebars = React.useCallback( - (threadInfo: ThreadInfo) => { + (threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo) => { 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 @@ -5,7 +5,7 @@ import _flow from 'lodash/fp/flow.js'; import _sortBy from 'lodash/fp/sortBy.js'; import * as React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import { newThreadActionTypes, @@ -16,8 +16,9 @@ import { userInfoSelectorForPotentialMembers } from 'lib/selectors/user-selectors.js'; import { usePotentialMemberItems } from 'lib/shared/search-utils.js'; import { threadInFilterList, userIsMember } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type ThreadType, threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.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'; @@ -26,8 +27,8 @@ import ParentThreadHeader from './parent-thread-header.react.js'; import LinkButton from '../components/link-button.react.js'; import { - createTagInput, type BaseTagInput, + createTagInput, } from '../components/tag-input.react.js'; import ThreadList from '../components/thread-list.react.js'; import UserList from '../components/user-list.react.js'; @@ -49,7 +50,7 @@ export type ComposeSubchannelParams = { +threadType: ThreadType, - +parentThreadInfo: ThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { @@ -204,13 +205,15 @@ threadType, }); - const existingThreads: $ReadOnlyArray = React.useMemo(() => { + const existingThreads: $ReadOnlyArray< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + > = React.useMemo(() => { if (userInfoInputIDs.length === 0) { return []; } return _flow( _filter( - (threadInfo: ThreadInfo) => + (threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo) => threadInFilterList(threadInfo) && threadInfo.parentThreadID === parentThreadInfo.id && userInfoInputIDs.every(userID => userIsMember(threadInfo, userID)), @@ -218,8 +221,14 @@ _sortBy( ([ 'members.length', - (threadInfo: ThreadInfo) => (threadInfo.name ? 1 : 0), - ]: $ReadOnlyArray mixed)>), + (threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo) => + threadInfo.name ? 1 : 0, + ]: $ReadOnlyArray< + | string + | (( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => mixed), + >), ), )(threadInfos); }, [userInfoInputIDs, threadInfos, parentThreadInfo]); 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 @@ -7,9 +7,10 @@ import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { messageID } from 'lib/shared/message-utils.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; -import { assertComposableRawMessage } from 'lib/types/message-types.js'; import type { RawComposableMessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import { assertComposableRawMessage } from 'lib/types/message-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -46,7 +47,7 @@ +rawMessageInfo: ?RawComposableMessageInfo, +styles: $ReadOnly, +inputState: ?InputState, - +parentThreadInfo: ?ThreadInfo, + +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; class FailedSend extends React.PureComponent { retryingText = false; diff --git a/native/chat/fullscreen-thread-media-gallery.react.js b/native/chat/fullscreen-thread-media-gallery.react.js --- a/native/chat/fullscreen-thread-media-gallery.react.js +++ b/native/chat/fullscreen-thread-media-gallery.react.js @@ -1,9 +1,10 @@ // @flow import * as React from 'react'; -import { Text, View, TouchableOpacity } from 'react-native'; +import { Text, TouchableOpacity, View } from 'react-native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 ThreadSettingsMediaGallery from './settings/thread-settings-media-gallery.react.js'; @@ -12,7 +13,7 @@ import type { VerticalBounds } from '../types/layout-types.js'; export type FullScreenThreadMediaGalleryParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; const Tabs = { 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 @@ -2,11 +2,12 @@ import invariant from 'invariant'; import * as React from 'react'; -import { Button, View, Image } from 'react-native'; +import { Button, Image, View } from 'react-native'; import filesystem from 'react-native-fs'; import type { PhotoPaste } from 'lib/types/media-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -17,7 +18,7 @@ export type ImagePasteModalParams = { +imagePasteStagingInfo: PhotoPaste, - +thread: ThreadInfo, + +thread: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; 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 @@ -13,15 +13,16 @@ import { getInlineEngagementSidebarText } from 'lib/shared/inline-engagement-utils.js'; import { useNextLocalID } from 'lib/shared/message-utils.js'; import type { MessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { - inlineEngagementLabelStyle, - inlineEngagementStyle, + avatarOffset, + composedMessageStyle, inlineEngagementCenterStyle, + inlineEngagementLabelStyle, inlineEngagementRightStyle, - composedMessageStyle, - avatarOffset, + inlineEngagementStyle, } from './chat-constants.js'; import { useNavigateToThread } from './message-list-types.js'; import { useSendReaction } from './reaction-message-utils.js'; @@ -32,7 +33,7 @@ import type { ChatMessageInfoItemWithHeight } from '../types/chat-types.js'; function dummyNodeForInlineEngagementHeightMeasurement( - sidebarInfo: ?ThreadInfo, + sidebarInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, reactions: ReactionInfo, ): React.Element { return ( @@ -48,7 +49,7 @@ type DummyInlineEngagementNodeProps = { ...React.ElementConfig, +editedLabel?: ?string, - +sidebarInfo: ?ThreadInfo, + +sidebarInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +reactions: ReactionInfo, }; function DummyInlineEngagementNode( @@ -128,8 +129,8 @@ type Props = { +messageInfo: MessageInfo, - +threadInfo: ThreadInfo, - +sidebarThreadInfo: ?ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + +sidebarThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +reactions: ReactionInfo, +disabled?: boolean, +positioning?: 'left' | 'right' | 'center', diff --git a/native/chat/inner-robotext-message.react.js b/native/chat/inner-robotext-message.react.js --- a/native/chat/inner-robotext-message.react.js +++ b/native/chat/inner-robotext-message.react.js @@ -6,12 +6,13 @@ import type { ReactionInfo } from 'lib/selectors/chat-selectors.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { - entityTextToReact, + type EntityText, entityTextToRawString, + entityTextToReact, useENSNamesForEntityText, - type EntityText, } from 'lib/utils/entity-text.js'; import { DummyInlineEngagementNode } from './inline-engagement.react.js'; @@ -26,7 +27,7 @@ function dummyNodeForRobotextMessageHeightMeasurement( robotext: EntityText, threadID: string, - sidebarInfo: ?ThreadInfo, + sidebarInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, reactions: ReactionInfo, ): React.Element { return ( diff --git a/native/chat/inner-text-message.react.js b/native/chat/inner-text-message.react.js --- a/native/chat/inner-text-message.react.js +++ b/native/chat/inner-text-message.react.js @@ -1,12 +1,13 @@ // @flow import * as React from 'react'; -import { View, StyleSheet, TouchableWithoutFeedback } from 'react-native'; +import { StyleSheet, TouchableWithoutFeedback, View } from 'react-native'; import Animated from 'react-native-reanimated'; import type { ReactionInfo } from 'lib/selectors/chat-selectors.js'; import { colorIsDark } from 'lib/shared/color-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useComposedMessageMaxWidth } from './composed-message-width.js'; import { DummyInlineEngagementNode } from './inline-engagement.react.js'; @@ -23,7 +24,7 @@ import GestureTouchableOpacity from '../components/gesture-touchable-opacity.react.js'; import Markdown from '../markdown/markdown.react.js'; import { useSelector } from '../redux/redux-utils.js'; -import { useColors, colors } from '../themes/colors.js'; +import { colors, useColors } from '../themes/colors.js'; import type { ChatTextMessageInfoItemWithHeight } from '../types/chat-types.js'; const { Node } = Animated; @@ -31,7 +32,7 @@ function dummyNodeForTextMessageHeightMeasurement( text: string, editedLabel?: ?string, - sidebarInfo: ?ThreadInfo, + sidebarInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, reactions: ReactionInfo, ): React.Element { return ( 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 @@ -4,7 +4,7 @@ import { useNavigationState } from '@react-navigation/native'; import invariant from 'invariant'; import * as React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import genesis from 'lib/facts/genesis.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; @@ -14,10 +14,11 @@ useSearchUsers, } from 'lib/shared/search-utils.js'; import { - useExistingThreadInfoFinder, pendingThreadType, + useExistingThreadInfoFinder, } from 'lib/shared/thread-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -40,8 +41,8 @@ } from '../navigation/overlay-context.js'; import type { NavigationRoute } from '../navigation/route-names.js'; import { - ThreadSettingsRouteName, MessageResultsScreenRouteName, + ThreadSettingsRouteName, } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { type Colors, useColors, useStyles } from '../themes/colors.js'; @@ -86,8 +87,8 @@ +updateTagInput: (items: $ReadOnlyArray) => void, +resolveToUser: (user: AccountUserInfo) => void, +userSearchResults: $ReadOnlyArray, - +threadInfo: ThreadInfo, - +genesisThreadInfo: ?ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + +genesisThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +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 @@ -5,7 +5,8 @@ import * as React from 'react'; import { View } from 'react-native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -30,7 +31,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +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 @@ -6,7 +6,8 @@ import * as React from 'react'; import { useThreadChatMentionCandidates } from 'lib/hooks/chat-mention-hooks.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -19,7 +20,7 @@ } from '../navigation/route-names.js'; export type MessageListParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +pendingPersonalThreadUserInfo?: UserInfo, +searching?: boolean, +removeEditMode?: ?RemoveEditMode, @@ -36,7 +37,9 @@ const MessageListContext: React.Context = React.createContext(); -function useMessageListContext(threadInfo: ThreadInfo) { +function useMessageListContext( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +) { const chatMentionCandidates = useThreadChatMentionCandidates(threadInfo); const getTextMessageMarkdownRules = useTextMessageRulesFunc( threadInfo, @@ -52,7 +55,7 @@ type Props = { +children: React.Node, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function MessageListContextProvider(props: Props): React.Node { const context = useMessageListContext(props.threadInfo); @@ -95,7 +98,7 @@ } function useNavigateToThreadWithFadeAnimation( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, messageKey: ?string, ): () => mixed { const chatContext = React.useContext(ChatContext); diff --git a/native/chat/message-list.react.js b/native/chat/message-list.react.js --- a/native/chat/message-list.react.js +++ b/native/chat/message-list.react.js @@ -3,27 +3,28 @@ import invariant from 'invariant'; import _find from 'lodash/fp/find.js'; import * as React from 'react'; -import { View, TouchableWithoutFeedback } from 'react-native'; +import { TouchableWithoutFeedback, View } from 'react-native'; import { createSelector } from 'reselect'; import { fetchMessagesBeforeCursorActionTypes, - useFetchMessagesBeforeCursor, + type FetchMessagesBeforeCursorInput, fetchMostRecentMessagesActionTypes, - useFetchMostRecentMessages, type FetchMostRecentMessagesInput, - type FetchMessagesBeforeCursorInput, + useFetchMessagesBeforeCursor, + useFetchMostRecentMessages, } from 'lib/actions/message-actions.js'; import { useOldestMessageServerID } from 'lib/hooks/message-hooks.js'; import { registerFetchKey } from 'lib/reducers/loading-reducer.js'; import { messageKey } from 'lib/shared/message-utils.js'; import { useWatchThread } from 'lib/shared/thread-utils.js'; import type { FetchMessageInfosPayload } from 'lib/types/message-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import ChatList from './chat-list.react.js'; @@ -32,8 +33,8 @@ import RelationshipPrompt from './relationship-prompt.react.js'; import ListLoadingIndicator from '../components/list-loading-indicator.react.js'; import { - type KeyboardState, KeyboardContext, + type KeyboardState, } from '../keyboard/keyboard-state.js'; import { defaultStackScreenOptions } from '../navigation/options.js'; import { @@ -43,9 +44,9 @@ import type { NavigationRoute } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { - useStyles, type IndicatorStyle, useIndicatorStyle, + useStyles, } from '../themes/colors.js'; import type { ChatMessageInfoItemWithHeight, @@ -68,7 +69,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +messageListData: $ReadOnlyArray, +navigation: ChatNavigationProp<'MessageList'>, +route: NavigationRoute<'MessageList'>, diff --git a/native/chat/message-preview.react.js b/native/chat/message-preview.react.js --- a/native/chat/message-preview.react.js +++ b/native/chat/message-preview.react.js @@ -7,7 +7,8 @@ import { useThreadChatMentionCandidates } from 'lib/hooks/chat-mention-hooks.js'; import { useMessagePreview } from 'lib/shared/message-utils.js'; import { type MessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import SingleLine from '../components/single-line.react.js'; import { getDefaultTextMessageRules } from '../markdown/rules.react.js'; @@ -15,7 +16,7 @@ type Props = { +messageInfo: MessageInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function MessagePreview(props: Props): React.Node { const { messageInfo, threadInfo } = props; 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 @@ -4,7 +4,8 @@ import { Text, View } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -19,7 +20,7 @@ type MessageResultProps = { +item: ChatMessageInfoItemWithHeight, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +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 @@ -7,15 +7,16 @@ import { useFetchPinnedMessages } from 'lib/actions/message-actions.js'; import { - messageListData, type ChatMessageInfoItem, + messageListData, } from 'lib/selectors/chat-selectors.js'; import { createMessageInfo, isInvalidPinSourceForThread, } from 'lib/shared/message-utils.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -28,7 +29,7 @@ import type { VerticalBounds } from '../types/layout-types.js'; export type MessageResultsScreenParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; 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 @@ -1,11 +1,12 @@ // @flow import * as React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadType } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useNavigateToThread } from './message-list-types.js'; import Button from '../components/button.react.js'; @@ -14,7 +15,7 @@ import { useColors, useStyles } from '../themes/colors.js'; type Props = { - +parentThreadInfo: ThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +childThreadType: ThreadType, }; function ParentThreadHeader(props: Props): React.Node { diff --git a/native/chat/relationship-prompt.react.js b/native/chat/relationship-prompt.react.js --- a/native/chat/relationship-prompt.react.js +++ b/native/chat/relationship-prompt.react.js @@ -5,8 +5,9 @@ import { Text, View } from 'react-native'; import { useRelationshipPrompt } from 'lib/hooks/relationship-prompt.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from 'lib/types/relationship-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { UserInfo } from 'lib/types/user-types.js'; import Button from '../components/button.react.js'; @@ -15,7 +16,7 @@ type Props = { +pendingPersonalThreadUserInfo: ?UserInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; const RelationshipPrompt: React.ComponentType = React.memo( diff --git a/native/chat/settings/add-users-modal.react.js b/native/chat/settings/add-users-modal.react.js --- a/native/chat/settings/add-users-modal.react.js +++ b/native/chat/settings/add-users-modal.react.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react'; -import { View, Text, ActivityIndicator } from 'react-native'; +import { ActivityIndicator, Text, View } from 'react-native'; import { changeThreadSettingsActionTypes, @@ -13,15 +13,16 @@ import { userInfoSelectorForPotentialMembers } from 'lib/selectors/user-selectors.js'; import { usePotentialMemberItems } from 'lib/shared/search-utils.js'; import { threadActualMembers } from 'lib/shared/thread-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.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'; import Button from '../../components/button.react.js'; import Modal from '../../components/modal.react.js'; import { - createTagInput, type BaseTagInput, + createTagInput, } from '../../components/tag-input.react.js'; import UserList from '../../components/user-list.react.js'; import type { RootNavigationProp } from '../../navigation/root-navigator.react.js'; @@ -42,7 +43,7 @@ export type AddUsersModalParams = { +presentedFrom: string, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { diff --git a/native/chat/settings/color-selector-modal.react.js b/native/chat/settings/color-selector-modal.react.js --- a/native/chat/settings/color-selector-modal.react.js +++ b/native/chat/settings/color-selector-modal.react.js @@ -8,14 +8,15 @@ changeThreadSettingsActionTypes, useChangeThreadSettings, } from 'lib/actions/thread-actions.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type ChangeThreadSettingsPayload, type UpdateThreadRequest, - type ThreadInfo, + type LegacyThreadInfo, } from 'lib/types/thread-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import ColorSelector from '../../components/color-selector.react.js'; @@ -23,13 +24,13 @@ import type { RootNavigationProp } from '../../navigation/root-navigator.react.js'; import type { NavigationRoute } from '../../navigation/route-names.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'; export type ColorSelectorModalParams = { +presentedFrom: string, +color: string, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +setColor: (color: string) => void, }; 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 @@ -5,8 +5,9 @@ import { Text } from 'react-native'; import { threadTypeDescriptions } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import Button from '../../components/button.react.js'; import Modal from '../../components/modal.react.js'; @@ -14,11 +15,11 @@ import type { RootNavigationProp } from '../../navigation/root-navigator.react.js'; import type { NavigationRoute } from '../../navigation/route-names.js'; import { ComposeSubchannelRouteName } from '../../navigation/route-names.js'; -import { type Colors, useStyles, useColors } from '../../themes/colors.js'; +import { type Colors, useColors, useStyles } from '../../themes/colors.js'; export type ComposeSubchannelModalParams = { +presentedFrom: string, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; const unboundStyles = { 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 @@ -3,44 +3,45 @@ import invariant from 'invariant'; import * as React from 'react'; import { + ActivityIndicator, Text, - View, TextInput as BaseTextInput, - ActivityIndicator, + View, } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; +import type { DeleteThreadInput } from 'lib/actions/thread-actions.js'; import { deleteThreadActionTypes, useDeleteThread, } from 'lib/actions/thread-actions.js'; -import type { DeleteThreadInput } from 'lib/actions/thread-actions.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { - threadInfoSelector, containedThreadInfos, + threadInfoSelector, } from 'lib/selectors/thread-selectors.js'; import { - identifyInvalidatedThreads, getThreadsToDeleteText, + identifyInvalidatedThreads, } from 'lib/shared/thread-utils.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { LeaveThreadPayload, - ThreadInfo, + LegacyThreadInfo, ResolvedThreadInfo, } from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import Button from '../../components/button.react.js'; import { clearThreadsActionType } from '../../navigation/action-types.js'; import { - NavContext, type NavAction, + NavContext, } from '../../navigation/navigation-context.js'; import type { NavigationRoute } from '../../navigation/route-names.js'; import { useSelector } from '../../redux/redux-utils.js'; @@ -49,7 +50,7 @@ import type { ChatNavigationProp } from '../chat.react.js'; export type DeleteThreadParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; const unboundStyles = { diff --git a/native/chat/settings/emoji-thread-avatar-creation.react.js b/native/chat/settings/emoji-thread-avatar-creation.react.js --- a/native/chat/settings/emoji-thread-avatar-creation.react.js +++ b/native/chat/settings/emoji-thread-avatar-creation.react.js @@ -6,8 +6,11 @@ import { EditThreadAvatarContext } from 'lib/components/base-edit-thread-avatar-provider.react.js'; import { savedEmojiAvatarSelectorForThread } from 'lib/selectors/thread-selectors.js'; import type { UpdateUserAvatarRequest } from 'lib/types/avatar-types.js'; -import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useNativeSetThreadAvatar } from '../../avatars/avatar-hooks.js'; import EmojiAvatarCreation from '../../avatars/emoji-avatar-creation.react.js'; @@ -17,7 +20,7 @@ import { useSelector } from '../../redux/redux-utils.js'; export type EmojiThreadAvatarCreationParams = { - +threadInfo: RawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { 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 @@ -1,9 +1,10 @@ // @flow import * as React from 'react'; -import { View, Platform } from 'react-native'; +import { Platform, View } from 'react-native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 +14,7 @@ import { useNavigateToThread } from '../message-list-types.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +firstListItem: boolean, +lastListItem: boolean, }; diff --git a/native/chat/settings/thread-settings-color.react.js b/native/chat/settings/thread-settings-color.react.js --- a/native/chat/settings/thread-settings-color.react.js +++ b/native/chat/settings/thread-settings-color.react.js @@ -1,12 +1,13 @@ // @flow import * as React from 'react'; -import { Text, ActivityIndicator, View, Platform } from 'react-native'; +import { ActivityIndicator, Platform, Text, View } from 'react-native'; import { changeThreadSettingsActionTypes } 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 { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { ThreadSettingsNavigate } from './thread-settings.react.js'; import ColorSplotch from '../../components/color-splotch.react.js'; @@ -38,7 +39,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +colorEditValue: string, +setColorEditValue: (color: string) => void, +canChangeSettings: boolean, diff --git a/native/chat/settings/thread-settings-description.react.js b/native/chat/settings/thread-settings-description.react.js --- a/native/chat/settings/thread-settings-description.react.js +++ b/native/chat/settings/thread-settings-description.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'; @@ -16,31 +16,32 @@ import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { threadHasPermission } from 'lib/shared/thread-utils.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; import { type ChangeThreadSettingsPayload, type UpdateThreadRequest, - type ThreadInfo, + type LegacyThreadInfo, } from 'lib/types/thread-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import SaveSettingButton from './save-setting-button.react.js'; import { - ThreadSettingsCategoryHeader, ThreadSettingsCategoryFooter, + ThreadSettingsCategoryHeader, } from './thread-settings-category.react.js'; import Button from '../../components/button.react.js'; import EditSettingButton from '../../components/edit-setting-button.react.js'; import SWMansionIcon from '../../components/swmansion-icon.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 type { - LayoutEvent, ContentSizeChangeEvent, + LayoutEvent, } from '../../types/react-native.js'; import Alert from '../../utils/alert.js'; @@ -87,7 +88,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +descriptionEditValue: ?string, +setDescriptionEditValue: (value: ?string, callback?: () => void) => void, +descriptionTextHeight: ?number, diff --git a/native/chat/settings/thread-settings-edit-relationship.react.js b/native/chat/settings/thread-settings-edit-relationship.react.js --- a/native/chat/settings/thread-settings-edit-relationship.react.js +++ b/native/chat/settings/thread-settings-edit-relationship.react.js @@ -14,22 +14,23 @@ getRelationshipDispatchAction, } from 'lib/shared/relationship-utils.js'; import { getSingleOtherUser } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type RelationshipAction, type RelationshipButton, } from 'lib/types/relationship-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useServerCall } from 'lib/utils/action-utils.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import Button from '../../components/button.react.js'; import { useSelector } from '../../redux/redux-utils.js'; -import { useStyles, useColors } from '../../themes/colors.js'; +import { useColors, useStyles } from '../../themes/colors.js'; import type { ViewStyle } from '../../types/styles.js'; import Alert from '../../utils/alert.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +buttonStyle: ViewStyle, +relationshipButton: RelationshipButton, }; diff --git a/native/chat/settings/thread-settings-home-notifs.react.js b/native/chat/settings/thread-settings-home-notifs.react.js --- a/native/chat/settings/thread-settings-home-notifs.react.js +++ b/native/chat/settings/thread-settings-home-notifs.react.js @@ -1,20 +1,21 @@ // @flow import * as React from 'react'; -import { View, Switch } from 'react-native'; +import { Switch, View } from 'react-native'; import { updateSubscriptionActionTypes, useUpdateSubscription, } from 'lib/actions/user-actions.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { SubscriptionUpdateRequest, SubscriptionUpdateResult, } from 'lib/types/subscription-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import SingleLine from '../../components/single-line.react.js'; @@ -43,7 +44,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { ...BaseProps, diff --git a/native/chat/settings/thread-settings-leave-thread.react.js b/native/chat/settings/thread-settings-leave-thread.react.js --- a/native/chat/settings/thread-settings-leave-thread.react.js +++ b/native/chat/settings/thread-settings-leave-thread.react.js @@ -2,21 +2,25 @@ import invariant from 'invariant'; import * as React from 'react'; -import { Text, ActivityIndicator, View } from 'react-native'; +import { ActivityIndicator, Text, View } from 'react-native'; +import type { LeaveThreadInput } from 'lib/actions/thread-actions.js'; import { leaveThreadActionTypes, useLeaveThread, } from 'lib/actions/thread-actions.js'; -import type { LeaveThreadInput } from 'lib/actions/thread-actions.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { otherUsersButNoOtherAdmins } from 'lib/selectors/thread-selectors.js'; import { identifyInvalidatedThreads } from 'lib/shared/thread-utils.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { LeaveThreadPayload, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LeaveThreadPayload, + LegacyThreadInfo, +} from 'lib/types/thread-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import Button from '../../components/button.react.js'; @@ -48,7 +52,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +buttonStyle: ViewStyle, }; type Props = { diff --git a/native/chat/settings/thread-settings-member-tooltip-modal.react.js b/native/chat/settings/thread-settings-member-tooltip-modal.react.js --- a/native/chat/settings/thread-settings-member-tooltip-modal.react.js +++ b/native/chat/settings/thread-settings-member-tooltip-modal.react.js @@ -5,24 +5,28 @@ import { useRemoveUsersFromThread } from 'lib/actions/thread-actions.js'; import { removeMemberFromThread } from 'lib/shared/thread-utils.js'; import { stringForUser } from 'lib/shared/user-utils.js'; -import type { RelativeMemberInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + RelativeMemberInfo, +} from 'lib/types/thread-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import ThreadSettingsMemberTooltipButton from './thread-settings-member-tooltip-button.react.js'; import type { AppNavigationProp } from '../../navigation/app-navigator.react'; import { ChangeRolesScreenRouteName } from '../../navigation/route-names.js'; import { + type BaseTooltipProps, createTooltip, + type TooltipMenuProps, type TooltipParams, type TooltipRoute, - type BaseTooltipProps, - type TooltipMenuProps, } from '../../tooltip/tooltip.react.js'; import Alert from '../../utils/alert.js'; export type ThreadSettingsMemberTooltipModalParams = TooltipParams<{ +memberInfo: RelativeMemberInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }>; function useOnRemoveUser( diff --git a/native/chat/settings/thread-settings-member.react.js b/native/chat/settings/thread-settings-member.react.js --- a/native/chat/settings/thread-settings-member.react.js +++ b/native/chat/settings/thread-settings-member.react.js @@ -3,23 +3,27 @@ import invariant from 'invariant'; import * as React from 'react'; import { - View, - Text, - Platform, ActivityIndicator, + Platform, + Text, TouchableOpacity, + View, } from 'react-native'; import { - removeUsersFromThreadActionTypes, changeThreadMemberRolesActionTypes, + removeUsersFromThreadActionTypes, } from 'lib/actions/thread-actions.js'; import { useENSNames } from 'lib/hooks/ens-cache.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { getAvailableThreadMemberActions } from 'lib/shared/thread-utils.js'; import { stringForUser } from 'lib/shared/user-utils.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { RelativeMemberInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + RelativeMemberInfo, +} from 'lib/types/thread-types.js'; import { useRolesFromCommunityThreadInfo } from 'lib/utils/role-utils.js'; import type { ThreadSettingsNavigate } from './thread-settings.react.js'; @@ -27,8 +31,8 @@ import PencilIcon from '../../components/pencil-icon.react.js'; import SingleLine from '../../components/single-line.react.js'; import { - type KeyboardState, KeyboardContext, + type KeyboardState, } from '../../keyboard/keyboard-state.js'; import { OverlayContext, @@ -87,7 +91,7 @@ type BaseProps = { +memberInfo: RelativeMemberInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +canEdit: boolean, +navigate: ThreadSettingsNavigate, +firstListItem: 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 @@ -3,7 +3,8 @@ import * as React from 'react'; import { Text, View } from 'react-native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -12,7 +13,7 @@ import { useNavigateToThread } from '../message-list-types.js'; type ParentButtonProps = { - +parentThreadInfo: ThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ParentButton(props: ParentButtonProps): React.Node { const styles = useStyles(unboundStyles); @@ -34,8 +35,8 @@ } type ThreadSettingsParentProps = { - +threadInfo: ThreadInfo, - +parentThreadInfo: ?ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; function ThreadSettingsParent(props: ThreadSettingsParentProps): React.Node { const { threadInfo, parentThreadInfo } = props; diff --git a/native/chat/settings/thread-settings-promote-sidebar.react.js b/native/chat/settings/thread-settings-promote-sidebar.react.js --- a/native/chat/settings/thread-settings-promote-sidebar.react.js +++ b/native/chat/settings/thread-settings-promote-sidebar.react.js @@ -1,11 +1,12 @@ // @flow import * as React from 'react'; -import { Text, ActivityIndicator, View } from 'react-native'; +import { ActivityIndicator, Text, View } from 'react-native'; import { usePromoteSidebar } from 'lib/hooks/promote-sidebar.react.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import Button from '../../components/button.react.js'; import { type Colors, useColors, useStyles } from '../../themes/colors.js'; @@ -30,7 +31,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +buttonStyle: ViewStyle, }; type Props = { diff --git a/native/chat/settings/thread-settings-push-notifs.react.js b/native/chat/settings/thread-settings-push-notifs.react.js --- a/native/chat/settings/thread-settings-push-notifs.react.js +++ b/native/chat/settings/thread-settings-push-notifs.react.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react'; -import { View, Switch, TouchableOpacity, Platform } from 'react-native'; +import { Platform, Switch, TouchableOpacity, View } from 'react-native'; import Linking from 'react-native/Libraries/Linking/Linking.js'; import { @@ -10,14 +10,15 @@ } from 'lib/actions/user-actions.js'; import { extractKeyserverIDFromID } from 'lib/keyserver-conn/keyserver-call-utils.js'; import { deviceTokenSelector } from 'lib/selectors/keyserver-selectors.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { SubscriptionUpdateRequest, SubscriptionUpdateResult, } from 'lib/types/subscription-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import SingleLine from '../../components/single-line.react.js'; @@ -53,7 +54,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { ...BaseProps, diff --git a/native/chat/settings/thread-settings-visibility.react.js b/native/chat/settings/thread-settings-visibility.react.js --- a/native/chat/settings/thread-settings-visibility.react.js +++ b/native/chat/settings/thread-settings-visibility.react.js @@ -3,13 +3,14 @@ import * as React from 'react'; import { Text, View } from 'react-native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import ThreadVisibility from '../../components/thread-visibility.react.js'; -import { useStyles, useColors } from '../../themes/colors.js'; +import { useColors, useStyles } from '../../themes/colors.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ThreadSettingsVisibility(props: Props): React.Node { const styles = useStyles(unboundStyles); 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 @@ -1,59 +1,60 @@ // @flow import type { - TabNavigationState, - BottomTabOptions, BottomTabNavigationEventMap, + BottomTabOptions, + TabNavigationState, } from '@react-navigation/core'; import invariant from 'invariant'; import * as React from 'react'; -import { View, Platform } from 'react-native'; +import { Platform, View } from 'react-native'; import { FlatList } from 'react-native-gesture-handler'; import { createSelector } from 'reselect'; import tinycolor from 'tinycolor2'; import { + changeThreadMemberRolesActionTypes, changeThreadSettingsActionTypes, leaveThreadActionTypes, removeUsersFromThreadActionTypes, - changeThreadMemberRolesActionTypes, } from 'lib/actions/thread-actions.js'; import { usePromoteSidebar } from 'lib/hooks/promote-sidebar.react.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { - threadInfoSelector, childThreadInfos, + threadInfoSelector, } from 'lib/selectors/thread-selectors.js'; import { getAvailableRelationshipButtons } from 'lib/shared/relationship-utils.js'; import { + getSingleOtherUser, threadHasPermission, - viewerIsMember, threadInChatList, - getSingleOtherUser, threadIsChannel, + viewerIsMember, } from 'lib/shared/thread-utils.js'; import threadWatcher from 'lib/shared/thread-watcher.js'; +import type { MinimallyEncodedThreadInfo } 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 { + LegacyThreadInfo, RelativeMemberInfo, - ThreadInfo, ResolvedThreadInfo, } from 'lib/types/thread-types.js'; import type { UserInfos } from 'lib/types/user-types.js'; import { - useResolvedThreadInfo, useResolvedOptionalThreadInfo, useResolvedOptionalThreadInfos, + useResolvedThreadInfo, } from 'lib/utils/entity-helpers.js'; import ThreadSettingsAvatar from './thread-settings-avatar.react.js'; import type { CategoryType } from './thread-settings-category.react.js'; import { - ThreadSettingsCategoryHeader, ThreadSettingsCategoryActionHeader, ThreadSettingsCategoryFooter, + ThreadSettingsCategoryHeader, } from './thread-settings-category.react.js'; import ThreadSettingsChildThread from './thread-settings-child-thread.react.js'; import ThreadSettingsColor from './thread-settings-color.react.js'; @@ -63,9 +64,9 @@ import ThreadSettingsHomeNotifs from './thread-settings-home-notifs.react.js'; import ThreadSettingsLeaveThread from './thread-settings-leave-thread.react.js'; import { - ThreadSettingsSeeMore, ThreadSettingsAddMember, ThreadSettingsAddSubchannel, + ThreadSettingsSeeMore, } from './thread-settings-list-action.react.js'; import ThreadSettingsMediaGallery from './thread-settings-media-gallery.react.js'; import ThreadSettingsMember from './thread-settings-member.react.js'; @@ -76,8 +77,8 @@ import ThreadSettingsVisibility from './thread-settings-visibility.react.js'; import ThreadAncestors from '../../components/thread-ancestors.react.js'; import { - type KeyboardState, KeyboardContext, + type KeyboardState, } from '../../keyboard/keyboard-state.js'; import { defaultStackScreenOptions } from '../../navigation/options.js'; import { @@ -88,16 +89,16 @@ AddUsersModalRouteName, ComposeSubchannelModalRouteName, FullScreenThreadMediaGalleryRouteName, - type ScreenParamList, type NavigationRoute, + type ScreenParamList, } from '../../navigation/route-names.js'; import type { TabNavigationProp } from '../../navigation/tab-navigator.react.js'; import { useSelector } from '../../redux/redux-utils.js'; import type { AppState } from '../../redux/state-types.js'; import { - useStyles, type IndicatorStyle, useIndicatorStyle, + useStyles, } from '../../themes/colors.js'; import type { VerticalBounds } from '../../types/layout-types.js'; import type { ViewStyle } from '../../types/styles.js'; @@ -106,7 +107,7 @@ const itemPageLength = 5; export type ThreadSettingsParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; export type ThreadSettingsNavigate = $PropertyType< @@ -219,7 +220,7 @@ | { +itemType: 'mediaGallery', +key: string, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +limit: number, +verticalBounds: ?VerticalBounds, } @@ -698,7 +699,10 @@ createSelector( (propsAndState: PropsAndState) => propsAndState.threadInfo, (propsAndState: PropsAndState) => propsAndState.verticalBounds, - (threadInfo: ThreadInfo, verticalBounds: ?VerticalBounds) => { + ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + verticalBounds: ?VerticalBounds, + ) => { const listData: ChatSettingsItem[] = []; const limit = 6; @@ -1152,9 +1156,8 @@ ); const threadID = props.route.params.threadInfo.id; - const reduxThreadInfo: ?ThreadInfo = useSelector( - state => threadInfoSelector(state)[threadID], - ); + const reduxThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo = + useSelector(state => threadInfoSelector(state)[threadID]); React.useEffect(() => { invariant( reduxThreadInfo, @@ -1169,7 +1172,7 @@ setParams({ threadInfo: reduxThreadInfo }); } }, [reduxThreadInfo, setParams]); - const threadInfo: ThreadInfo = + const threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo = reduxThreadInfo ?? props.route.params.threadInfo; const resolvedThreadInfo = useResolvedThreadInfo(threadInfo); @@ -1184,9 +1187,10 @@ }, [threadInfo]); const parentThreadID = threadInfo.parentThreadID; - const parentThreadInfo: ?ThreadInfo = useSelector(state => - parentThreadID ? threadInfoSelector(state)[parentThreadID] : null, - ); + const parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo = + useSelector(state => + parentThreadID ? threadInfoSelector(state)[parentThreadID] : null, + ); const resolvedParentThreadInfo = useResolvedOptionalThreadInfo(parentThreadInfo); const threadMembers = threadInfo.members; diff --git a/native/chat/sidebar-list-modal.react.js b/native/chat/sidebar-list-modal.react.js --- a/native/chat/sidebar-list-modal.react.js +++ b/native/chat/sidebar-list-modal.react.js @@ -4,7 +4,8 @@ import { View } from 'react-native'; import { useSearchSidebars } from 'lib/hooks/search-threads.js'; -import type { SidebarInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo, SidebarInfo } from 'lib/types/thread-types.js'; import { SidebarItem } from './sidebar-item.react.js'; import ThreadListModal from './thread-list-modal.react.js'; @@ -16,7 +17,7 @@ import Arrow from '../vectors/arrow.react.js'; export type SidebarListModalParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { @@ -30,7 +31,11 @@ const numOfSidebarsWithExtendedArrow = listData.length - 1; const createRenderItem = React.useCallback( - (onPressItem: (threadInfo: ThreadInfo) => void) => + ( + onPressItem: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, + ) => // eslint-disable-next-line react/display-name (row: { +item: SidebarInfo, +index: number, ... }) => { let extendArrow: boolean = false; @@ -64,7 +69,9 @@ function Item(props: { item: SidebarInfo, - onPressItem: (threadInfo: ThreadInfo) => void, + onPressItem: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, extendArrow: boolean, }): React.Node { const { item, onPressItem, extendArrow } = props; 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 @@ -10,9 +10,10 @@ createPendingSidebar, createUnresolvedPendingSidebar, } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ChatMentionCandidates, - ThreadInfo, + LegacyThreadInfo, } from 'lib/types/thread-types.js'; import type { LoggedInUserInfo } from 'lib/types/user-types.js'; import type { GetENSNames } from 'lib/utils/ens-helpers.js'; @@ -29,7 +30,7 @@ }; function getUnresolvedSidebarThreadInfo( input: GetUnresolvedSidebarThreadInfoInput, -): ?ThreadInfo { +): ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo { const { sourceMessage, loggedInUserInfo, chatMentionCandidates } = input; const threadCreatedFromMessage = sourceMessage.threadCreatedFromMessage; if (threadCreatedFromMessage) { @@ -56,7 +57,7 @@ }; async function getSidebarThreadInfo( input: GetSidebarThreadInfoInput, -): Promise { +): Promise { const { sourceMessage, loggedInUserInfo, diff --git a/native/chat/subchannels-list-modal.react.js b/native/chat/subchannels-list-modal.react.js --- a/native/chat/subchannels-list-modal.react.js +++ b/native/chat/subchannels-list-modal.react.js @@ -5,7 +5,8 @@ import { useSearchSubchannels } from 'lib/hooks/search-threads.js'; import type { ChatThreadItem } from 'lib/selectors/chat-selectors.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import SubchannelItem from './subchannel-item.react.js'; import ThreadListModal from './thread-list-modal.react.js'; @@ -15,7 +16,7 @@ import { useColors, useStyles } from '../themes/colors.js'; export type SubchannelListModalParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { @@ -41,14 +42,20 @@ } const createRenderItem = - (onPressItem: (threadInfo: ThreadInfo) => void) => + ( + onPressItem: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, + ) => // eslint-disable-next-line react/display-name (row: { +item: ChatThreadItem, +index: number, ... }) => { return ; }; function Item(props: { - onPressItem: (threadInfo: ThreadInfo) => void, + onPressItem: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, subchannelInfo: ChatThreadItem, }): React.Node { const { onPressItem, subchannelInfo } = props; 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 @@ -7,14 +7,18 @@ import SwipeableComponent from 'react-native-gesture-handler/Swipeable'; import useToggleUnreadStatus from 'lib/hooks/toggle-unread-status.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +mostRecentNonLocalMessage: ?string, - +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void, + +onSwipeableWillOpen: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => 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 @@ -3,17 +3,18 @@ import { useNavigation } from '@react-navigation/native'; import * as React from 'react'; import { + FlatList, Text, TextInput, - FlatList, - View, TouchableOpacity, + View, } from 'react-native'; import type { ThreadSearchState } from 'lib/hooks/search-threads.js'; import type { ChatThreadItem } from 'lib/selectors/chat-selectors.js'; import type { SetState } from 'lib/types/hook-types.js'; -import type { SidebarInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo, SidebarInfo } from 'lib/types/thread-types.js'; import { useNavigateToThread } from './message-list-types.js'; import Modal from '../components/modal.react.js'; @@ -34,9 +35,11 @@ } type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +createRenderItem: ( - onPressItem: (threadInfo: ThreadInfo) => void, + onPressItem: ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, ) => (row: { +item: U, +index: number, ... }) => React.Node, +listData: $ReadOnlyArray, +searchState: ThreadSearchState, @@ -77,7 +80,7 @@ const navigateToThread = useNavigateToThread(); const onPressItem = React.useCallback( - (threadInfo: ThreadInfo) => { + (threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo) => { 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 @@ -2,7 +2,8 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -18,7 +19,7 @@ }; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +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 @@ -4,12 +4,13 @@ import { HeaderTitle } from '@react-navigation/elements'; import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ...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 @@ -5,11 +5,12 @@ import { Text, View } from 'react-native'; import { - useToggleMessagePin, toggleMessagePinActionTypes, + useToggleMessagePin, } from 'lib/actions/message-actions.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -22,7 +23,7 @@ export type TogglePinModalParams = { +item: ChatMessageInfoItemWithHeight, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type TogglePinModalProps = { diff --git a/native/chat/utils.js b/native/chat/utils.js --- a/native/chat/utils.js +++ b/native/chat/utils.js @@ -9,14 +9,15 @@ import { colorIsDark } from 'lib/shared/color-utils.js'; import { messageKey } from 'lib/shared/message-utils.js'; import { viewerIsMember } from 'lib/shared/thread-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; import { failedSendHeight } from './failed-send.react.js'; import { - useNativeMessageListData, type NativeChatMessageItem, + useNativeMessageListData, } from './message-data.react.js'; import { authorNameHeight } from './message-header.react.js'; import { multimediaMessageItemHeight } from './multimedia-message-utils.js'; @@ -100,7 +101,7 @@ messageListVerticalBounds: VerticalBounds, currentInputBarHeight: number, targetInputBarHeight: number, - sidebarThreadInfo: ?ThreadInfo, + sidebarThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): { +position: number, +color: string, diff --git a/native/components/community-actions-button.react.js b/native/components/community-actions-button.react.js --- a/native/components/community-actions-button.react.js +++ b/native/components/community-actions-button.react.js @@ -8,22 +8,23 @@ import { primaryInviteLinksSelector } from 'lib/selectors/invite-links-selectors.js'; import { threadHasPermission } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import SWMansionIcon from './swmansion-icon.react.js'; import { + CommunityRolesScreenRouteName, InviteLinkNavigatorRouteName, ManagePublicLinkRouteName, - ViewInviteLinksRouteName, RolesNavigatorRouteName, - CommunityRolesScreenRouteName, + ViewInviteLinksRouteName, } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { useStyles } from '../themes/colors.js'; type Props = { - +community: ThreadInfo, + +community: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function CommunityActionsButton(props: Props): React.Node { 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 @@ -1,10 +1,11 @@ // @flow import * as React from 'react'; -import { View, StyleSheet } from 'react-native'; +import { StyleSheet, View } from 'react-native'; import { useKeyserverAdmin } from 'lib/shared/user-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -14,7 +15,7 @@ const threadPillRoundCorners = { left: false, right: true }; type Props = { - +community: ThreadInfo, + +community: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; 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 @@ -5,13 +5,14 @@ import { Text, View } from 'react-native'; import { useAncestorThreads } from 'lib/shared/ancestor-threads.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; 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 @@ -6,7 +6,8 @@ import { ScrollView } from 'react-native-gesture-handler'; import { ancestorThreadInfos } from 'lib/selectors/thread-selectors.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import Button from './button.react.js'; import CommunityPill from './community-pill.react.js'; @@ -16,7 +17,7 @@ import { useColors, useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ThreadAncestors(props: Props): React.Node { @@ -24,9 +25,9 @@ const styles = useStyles(unboundStyles); const colors = useColors(); - const ancestorThreads: $ReadOnlyArray = useSelector( - ancestorThreadInfos(threadInfo.id), - ); + const ancestorThreads: $ReadOnlyArray< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + > = 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 @@ -2,14 +2,18 @@ import * as React from 'react'; -import type { ResolvedThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + ResolvedThreadInfo, +} from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import Button from './button.react.js'; import SingleLine from './single-line.react.js'; import ThreadAvatar from '../avatars/thread-avatar.react.js'; -import { type Colors, useStyles, useColors } from '../themes/colors.js'; -import type { ViewStyle, TextStyle } from '../types/styles.js'; +import { type Colors, useColors, useStyles } from '../themes/colors.js'; +import type { TextStyle, ViewStyle } from '../types/styles.js'; const unboundStyles = { button: { @@ -33,7 +37,7 @@ }; type BaseProps = { ...SharedProps, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { ...SharedProps, 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 @@ -6,16 +6,17 @@ import { createSelector } from 'reselect'; import SearchIndex from 'lib/shared/search-index.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; import { type IndicatorStyle, - useStyles, useIndicatorStyle, + useStyles, } from '../themes/colors.js'; -import type { ViewStyle, TextStyle } from '../types/styles.js'; +import type { TextStyle, ViewStyle } from '../types/styles.js'; import { waitForModalInputFocus } from '../utils/timers.js'; const unboundStyles = { @@ -25,7 +26,7 @@ }; type BaseProps = { - +threadInfos: $ReadOnlyArray, + +threadInfos: $ReadOnlyArray, +onSelect: (threadID: string) => void, +itemStyle?: ViewStyle, +itemTextStyle?: TextStyle, @@ -49,26 +50,31 @@ }; textInput: ?React.ElementRef; - 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 { + listDataSelector: PropsAndState => $ReadOnlyArray< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + > = createSelector( + (propsAndState: PropsAndState) => propsAndState.threadInfos, + (propsAndState: PropsAndState) => propsAndState.searchText, + (propsAndState: PropsAndState) => propsAndState.searchResults, + (propsAndState: PropsAndState) => propsAndState.itemStyle, + (propsAndState: PropsAndState) => propsAndState.itemTextStyle, + ( + threadInfos: $ReadOnlyArray< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + >, + 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< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + > { return this.listDataSelector({ ...this.props, ...this.state }); } @@ -101,11 +107,16 @@ ); } - static keyExtractor = (threadInfo: ThreadInfo): string => { + static keyExtractor = ( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ): string => { return threadInfo.id; }; - renderItem = (row: { +item: ThreadInfo, ... }): React.Node => { + renderItem = (row: { + +item: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ... + }): 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 @@ -2,13 +2,14 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +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 @@ -6,72 +6,73 @@ import { Platform } from 'react-native'; import { createSelector } from 'reselect'; +import type { + SendMultimediaMessageInput, + SendTextMessageInput, +} from 'lib/actions/message-actions.js'; import { createLocalMessageActionType, sendMultimediaMessageActionTypes, - useSendMultimediaMessage, sendTextMessageActionTypes, + useSendMultimediaMessage, useSendTextMessage, } from 'lib/actions/message-actions.js'; -import type { - SendMultimediaMessageInput, - SendTextMessageInput, -} from 'lib/actions/message-actions.js'; import { queueReportsActionType } from 'lib/actions/report-actions.js'; import { useNewThread } from 'lib/actions/thread-actions.js'; import { - uploadMultimedia, - updateMultimediaMessageMediaActionType, - useBlobServiceUpload, - type MultimediaUploadCallbacks, - type MultimediaUploadExtras, type BlobServiceUploadAction, type BlobServiceUploadResult, + type MultimediaUploadCallbacks, + type MultimediaUploadExtras, + updateMultimediaMessageMediaActionType, + uploadMultimedia, + useBlobServiceUpload, } from 'lib/actions/upload-actions.js'; import commStaffCommunity from 'lib/facts/comm-staff-community.js'; import { pathFromURI, replaceExtension } from 'lib/media/file-utils.js'; import { - isLocalUploadID, getNextLocalUploadID, + isLocalUploadID, } from 'lib/media/media-utils.js'; import { videoDurationLimit } from 'lib/media/video-utils.js'; import { - createLoadingStatusSelector, combineLoadingStatuses, + createLoadingStatusSelector, } from 'lib/selectors/loading-selectors.js'; import { createMediaMessageInfo, - useNextLocalID, useMessageCreationSideEffectsFunc, + useNextLocalID, } from 'lib/shared/message-utils.js'; import type { CreationSideEffectsFunc } from 'lib/shared/messages/message-spec.js'; import { createRealThreadFromPendingThread, - threadIsPending, - threadIsPendingSidebar, patchThreadInfoToIncludeMentionedMembersOfParent, threadInfoInsideCommunity, + threadIsPending, + threadIsPendingSidebar, } from 'lib/shared/thread-utils.js'; import type { CalendarQuery } from 'lib/types/entry-types.js'; import type { - UploadMultimediaResult, Media, - NativeMediaSelection, - MediaMissionResult, MediaMission, + MediaMissionResult, MediaMissionStep, + NativeMediaSelection, + UploadMultimediaResult, } from 'lib/types/media-types.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import { type RawMessageInfo, type RawMultimediaMessageInfo, - type SendMessageResult, type SendMessagePayload, + type SendMessageResult, } from 'lib/types/message-types.js'; import type { RawImagesMessageInfo } from 'lib/types/messages/images.js'; import type { RawMediaMessageInfo } from 'lib/types/messages/media.js'; import { getMediaMessageServerDBContentsFromMedia } from 'lib/types/messages/media.js'; import type { RawTextMessageInfo } from 'lib/types/messages/text.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { Dispatch } from 'lib/types/redux-types.js'; import { type ClientMediaMissionReportCreationRequest, @@ -81,7 +82,7 @@ import { type ClientNewThreadRequest, type NewThreadResult, - type ThreadInfo, + type LegacyThreadInfo, } from 'lib/types/thread-types.js'; import { useServerCall } from 'lib/utils/action-utils.js'; import type { @@ -89,11 +90,11 @@ CallServerEndpointResponse, } from 'lib/utils/call-server-endpoint.js'; import { getConfig } from 'lib/utils/config.js'; -import { getMessageForException, cloneError } from 'lib/utils/errors.js'; +import { cloneError, getMessageForException } from 'lib/utils/errors.js'; import { values } from 'lib/utils/objects.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import { @@ -103,11 +104,11 @@ import { type EditInputBarMessageParameters, + type InputState, InputStateContext, - type PendingMultimediaUploads, - type MultimediaProcessingStep, type MessagePendingUploads, - type InputState, + type MultimediaProcessingStep, + type PendingMultimediaUploads, } from './input-state.js'; import { encryptMedia } from '../media/encryption-utils.js'; import { disposeTempFile } from '../media/file-utils.js'; @@ -173,7 +174,10 @@ > = []; scrollToMessageCallbacks: Array<(messageID: string) => void> = []; pendingThreadCreations: Map> = new Map(); - pendingThreadUpdateHandlers: Map mixed> = new Map(); + pendingThreadUpdateHandlers: Map< + string, + (LegacyThreadInfo | MinimallyEncodedThreadInfo) => mixed, + > = new Map(); // TODO: flip the switch // Note that this enables Blob service for encrypted media only useBlobServiceUploads = false; @@ -446,8 +450,8 @@ sendTextMessage = async ( messageInfo: RawTextMessageInfo, - inputThreadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + inputThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => { this.sendCallbacks.forEach(callback => callback()); @@ -543,7 +547,9 @@ ); }; - startThreadCreation(threadInfo: ThreadInfo): Promise { + startThreadCreation( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ): Promise { if (!threadIsPending(threadInfo.id)) { return Promise.resolve(threadInfo.id); } @@ -565,8 +571,8 @@ async sendTextMessageAction( messageInfo: RawTextMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): Promise { try { await this.props.textMessageCreationSideEffectsFunc( @@ -603,13 +609,15 @@ } } - shouldEncryptMedia(threadInfo: ThreadInfo): boolean { + shouldEncryptMedia( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ): boolean { return threadInfoInsideCommunity(threadInfo, commStaffCommunity.id); } sendMultimediaMessage = async ( selections: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ) => { this.sendCallbacks.forEach(callback => callback()); const localMessageID = this.props.nextLocalID; @@ -710,7 +718,7 @@ async uploadFiles( localMessageID: string, uploadFileInputs: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ) { const results = await Promise.all( uploadFileInputs.map(uploadFileInput => @@ -726,7 +734,7 @@ async uploadFile( localMessageID: string, uploadFileInput: UploadFileInput, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise { const { ids, selection } = uploadFileInput; const { localMediaID } = ids; @@ -1336,8 +1344,8 @@ retryTextMessage = async ( rawMessageInfo: RawTextMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => { await this.sendTextMessage( { @@ -1352,7 +1360,7 @@ retryMultimediaMessage = async ( rawMessageInfo: RawMultimediaMessageInfo, localMessageID: string, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): Promise => { const pendingUploads = this.state.pendingUploads[localMessageID] ?? {}; @@ -1566,8 +1574,8 @@ retryMessage = async ( localMessageID: string, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => { this.sendCallbacks.forEach(callback => callback()); @@ -1665,7 +1673,9 @@ setPendingThreadUpdateHandler = ( threadID: string, - pendingThreadUpdateHandler: ?(ThreadInfo) => mixed, + pendingThreadUpdateHandler: ?( + LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => 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 @@ -4,7 +4,8 @@ import type { NativeMediaSelection } from 'lib/types/media-types.js'; import type { RawTextMessageInfo } from 'lib/types/messages/text.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; export type MultimediaProcessingStep = 'transcoding' | 'uploading'; @@ -31,12 +32,12 @@ +pendingUploads: PendingMultimediaUploads, +sendTextMessage: ( messageInfo: RawTextMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => Promise, +sendMultimediaMessage: ( selections: $ReadOnlyArray, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ) => Promise, +editInputMessage: (params: EditInputBarMessageParameters) => void, +addEditInputMessageListener: ( @@ -48,8 +49,8 @@ +messageHasUploadFailure: (localMessageID: string) => boolean, +retryMessage: ( localMessageID: string, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => Promise, +registerSendCallback: (() => void) => void, +unregisterSendCallback: (() => void) => void, @@ -57,7 +58,9 @@ +reportURIDisplayed: (uri: string, loaded: boolean) => void, +setPendingThreadUpdateHandler: ( threadID: string, - pendingThreadUpdateHandler: ?(ThreadInfo) => mixed, + pendingThreadUpdateHandler: ?( + LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => mixed, ) => void, +scrollToMessage: (messageKey: string) => void, +addScrollToMessageListener: ((messageKey: string) => void) => void, diff --git a/native/invite-links/manage-public-link-screen.react.js b/native/invite-links/manage-public-link-screen.react.js --- a/native/invite-links/manage-public-link-screen.react.js +++ b/native/invite-links/manage-public-link-screen.react.js @@ -10,7 +10,8 @@ defaultErrorMessage, inviteLinkErrorMessages, } from 'lib/shared/invite-links.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import Button from '../components/button.react.js'; import TextInput from '../components/text-input.react.js'; @@ -21,7 +22,7 @@ import Alert from '../utils/alert.js'; export type ManagePublicLinkScreenParams = { - +community: ThreadInfo, + +community: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { diff --git a/native/invite-links/view-invite-links-screen.react.js b/native/invite-links/view-invite-links-screen.react.js --- a/native/invite-links/view-invite-links-screen.react.js +++ b/native/invite-links/view-invite-links-screen.react.js @@ -9,8 +9,9 @@ import { primaryInviteLinksSelector } from 'lib/selectors/invite-links-selectors.js'; import { threadHasPermission } from 'lib/shared/thread-utils.js'; import type { InviteLink } from 'lib/types/link-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import SingleLine from '../components/single-line.react.js'; import SWMansionIcon from '../components/swmansion-icon.react.js'; @@ -21,10 +22,10 @@ type NavigationRoute, } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; -import { useStyles, useColors } from '../themes/colors.js'; +import { useColors, useStyles } from '../themes/colors.js'; export type ViewInviteLinksScreenParams = { - +community: ThreadInfo, + +community: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { 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 @@ -6,9 +6,10 @@ import { KeyboardAccessoryView } from 'react-native-keyboard-input'; import type { MediaLibrarySelection } from 'lib/types/media-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; -import { type KeyboardState, KeyboardContext } from './keyboard-state.js'; +import { KeyboardContext, type KeyboardState } from './keyboard-state.js'; import { type InputState, InputStateContext } from '../input/input-state.js'; import { mediaGalleryKeyboardName } from '../media/media-gallery-keyboard.react.js'; import { activeMessageListSelector } from '../navigation/nav-selectors.js'; @@ -75,7 +76,7 @@ keyboardName: string, result: { +selections: $ReadOnlyArray, - +threadInfo: ?ThreadInfo, + +threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }, ) => { const { keyboardState } = this.props; diff --git a/native/keyboard/keyboard-state-container.react.js b/native/keyboard/keyboard-state-container.react.js --- a/native/keyboard/keyboard-state-container.react.js +++ b/native/keyboard/keyboard-state-container.react.js @@ -4,14 +4,15 @@ import { Platform } from 'react-native'; import { KeyboardUtils } from 'react-native-keyboard-input'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 KeyboardInputHost from './keyboard-input-host.react.js'; import { KeyboardContext } from './keyboard-state.js'; import { - addKeyboardShowListener, addKeyboardDismissListener, + addKeyboardShowListener, removeKeyboardListener, } from './keyboard.js'; import { tabBarAnimationDuration } from '../navigation/tab-bar.react.js'; @@ -23,7 +24,7 @@ type State = { +systemKeyboardShowing: boolean, +mediaGalleryOpen: boolean, - +mediaGalleryThread: ?ThreadInfo, + +mediaGalleryThread: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +renderKeyboardInputHost: boolean, }; class KeyboardStateContainer extends React.PureComponent { @@ -93,7 +94,9 @@ return systemKeyboardShowing || mediaGalleryOpen; } - showMediaGallery: (thread: ThreadInfo) => void = (thread: ThreadInfo) => { + showMediaGallery: ( + thread: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void = (thread: LegacyThreadInfo | MinimallyEncodedThreadInfo) => { this.setState({ mediaGalleryOpen: true, mediaGalleryThread: thread, @@ -108,8 +111,8 @@ }); }; - getMediaGalleryThread: () => ?ThreadInfo = () => - this.state.mediaGalleryThread; + getMediaGalleryThread: () => ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo = + () => this.state.mediaGalleryThread; render(): React.Node { const { systemKeyboardShowing, mediaGalleryOpen, renderKeyboardInputHost } = diff --git a/native/keyboard/keyboard-state.js b/native/keyboard/keyboard-state.js --- a/native/keyboard/keyboard-state.js +++ b/native/keyboard/keyboard-state.js @@ -2,7 +2,8 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; export type KeyboardState = { +keyboardShowing: boolean, @@ -10,9 +11,11 @@ +dismissKeyboardIfShowing: () => boolean, +systemKeyboardShowing: boolean, +mediaGalleryOpen: boolean, - +showMediaGallery: (thread: ThreadInfo) => void, + +showMediaGallery: ( + thread: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, +hideMediaGallery: () => void, - +getMediaGalleryThread: () => ?ThreadInfo, + +getMediaGalleryThread: () => ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; const KeyboardContext: React.Context = diff --git a/native/markdown/rules.react.js b/native/markdown/rules.react.js --- a/native/markdown/rules.react.js +++ b/native/markdown/rules.react.js @@ -2,14 +2,15 @@ import _memoize from 'lodash/memoize.js'; import * as React from 'react'; -import { Text, View, Platform } from 'react-native'; +import { Platform, Text, View } from 'react-native'; import * as SimpleMarkdown from 'simple-markdown'; import * as SharedMarkdown from 'lib/shared/markdown.js'; import { chatMentionRegex } from 'lib/shared/mention-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ChatMentionCandidates, - ThreadInfo, + LegacyThreadInfo, } from 'lib/types/thread-types.js'; import MarkdownChatMention from './markdown-chat-mention.react.js'; @@ -348,7 +349,7 @@ }); function useTextMessageRulesFunc( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, chatMentionCandidates: ChatMentionCandidates, ): (useDarkStyle: boolean) => MarkdownRules { const { members } = threadInfo; 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 @@ -4,7 +4,8 @@ import * as React from 'react'; import type { PhotoCapture } from 'lib/types/media-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -13,7 +14,7 @@ export type ChatCameraModalParams = { +presentedFrom: string, - +thread: ThreadInfo, + +thread: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { diff --git a/native/media/media-gallery-keyboard.react.js b/native/media/media-gallery-keyboard.react.js --- a/native/media/media-gallery-keyboard.react.js +++ b/native/media/media-gallery-keyboard.react.js @@ -5,13 +5,13 @@ import invariant from 'invariant'; import * as React from 'react'; import { - View, - Text, - FlatList, ActivityIndicator, Animated, Easing, + FlatList, Platform, + Text, + View, } from 'react-native'; import { KeyboardRegistry } from 'react-native-keyboard-input'; import { Provider } from 'react-redux'; @@ -22,7 +22,8 @@ } from 'lib/media/file-utils.js'; import { useIsAppForegrounded } from 'lib/shared/lifecycle-utils.js'; import type { MediaLibrarySelection } from 'lib/types/media-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { getCompatibleMediaURI } from './identifier-utils.js'; import MediaGalleryMedia from './media-gallery-media.react.js'; @@ -102,7 +103,7 @@ }; type BaseProps = { - +threadInfo: ?ThreadInfo, + +threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; type Props = { ...BaseProps, diff --git a/native/navigation/nav-selectors.js b/native/navigation/nav-selectors.js --- a/native/navigation/nav-selectors.js +++ b/native/navigation/nav-selectors.js @@ -15,31 +15,32 @@ ComposableMessageInfo, RobotextMessageInfo, } from 'lib/types/message-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { GlobalTheme } from 'lib/types/theme-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { NavContextType } from './navigation-context.js'; import { NavContext } from './navigation-context.js'; import { + currentLeafRoute, getStateFromNavigatorRoute, getThreadIDFromRoute, - currentLeafRoute, } from './navigation-utils.js'; import { + accountModals, + ActionResultModalRouteName, AppRouteName, - TabNavigatorRouteName, - MessageListRouteName, - ChatRouteName, CalendarRouteName, - ThreadPickerModalRouteName, - ActionResultModalRouteName, - accountModals, - scrollBlockingModals, chatRootModals, - threadRoutes, + ChatRouteName, CommunityDrawerNavigatorRouteName, + MessageListRouteName, MessageResultsScreenRouteName, MessageSearchRouteName, + scrollBlockingModals, + TabNavigatorRouteName, + ThreadPickerModalRouteName, + threadRoutes, } from './route-names.js'; import type { RemoveEditMode } from '../chat/message-list-types.js'; import { useSelector } from '../redux/redux-utils.js'; @@ -403,7 +404,7 @@ } function useCanEditMessageNative( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, targetMessageInfo: ComposableMessageInfo | RobotextMessageInfo, ): boolean { const route = useRoute(); diff --git a/native/navigation/subchannels-button.react.js b/native/navigation/subchannels-button.react.js --- a/native/navigation/subchannels-button.react.js +++ b/native/navigation/subchannels-button.react.js @@ -3,15 +3,16 @@ import Icon from '@expo/vector-icons/Feather.js'; import { useNavigation } from '@react-navigation/native'; import * as React from 'react'; -import { TouchableOpacity, Text, View } from 'react-native'; +import { Text, TouchableOpacity, View } from 'react-native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { SubchannelsListModalRouteName } from './route-names.js'; import { useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function SubchnnelsButton(props: Props): React.Node { 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 @@ -3,7 +3,7 @@ import * as Haptics from 'expo-haptics'; import invariant from 'invariant'; import * as React from 'react'; -import { Platform, LogBox } from 'react-native'; +import { LogBox, Platform } from 'react-native'; import { Notification as InAppNotification } from 'react-native-in-app-message'; import type { @@ -17,24 +17,25 @@ } from 'lib/actions/device-actions.js'; import { saveMessagesActionType } from 'lib/actions/message-actions.js'; import { - updatesCurrentAsOfSelector, connectionSelector, deviceTokensSelector, + updatesCurrentAsOfSelector, } from 'lib/selectors/keyserver-selectors.js'; import { - unreadCount, threadInfoSelector, + unreadCount, } from 'lib/selectors/thread-selectors.js'; import { isLoggedIn } from 'lib/selectors/user-selectors.js'; import { mergePrefixIntoBody } from 'lib/shared/notif-utils.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; 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 { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { - convertNotificationMessageInfoToNewIDSchema, convertNonPendingIDToNewSchema, + convertNotificationMessageInfoToNewIDSchema, } from 'lib/utils/migration-utils.js'; import { type NotifPermissionAlertInfo, @@ -42,20 +43,20 @@ shouldSkipPushPermissionAlert, } from 'lib/utils/push-alerts.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import sleep from 'lib/utils/sleep.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { - parseAndroidMessage, - androidNotificationChannelID, - handleAndroidMessage, - getCommAndroidNotificationsEventEmitter, type AndroidMessage, + androidNotificationChannelID, CommAndroidNotifications, + getCommAndroidNotificationsEventEmitter, + handleAndroidMessage, + parseAndroidMessage, } from './android.js'; import { CommIOSNotification, @@ -64,11 +65,11 @@ } from './comm-ios-notification.js'; import InAppNotif from './in-app-notif.react.js'; import { - requestIOSPushPermissions, - iosPushPermissionResponseReceived, CommIOSNotifications, - getCommIOSNotificationsEventEmitter, type CoreIOSNotificationBackgroundData, + getCommIOSNotificationsEventEmitter, + iosPushPermissionResponseReceived, + requestIOSPushPermissions, } from './ios.js'; import { type MessageListParams, @@ -104,7 +105,9 @@ +deviceTokens: { +[keyserverID: string]: ?string, }, - +threadInfos: { +[id: string]: ThreadInfo }, + +threadInfos: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, +notifPermissionAlertInfo: NotifPermissionAlertInfo, +connection: ConnectionInfo, +updatesCurrentAsOf: number, @@ -521,7 +524,10 @@ ); } - navigateToThread(threadInfo: ThreadInfo, clearChatRoutes: boolean) { + navigateToThread( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + clearChatRoutes: boolean, + ) { if (clearChatRoutes) { this.props.navigation.dispatch({ type: replaceWithThreadActionType, diff --git a/native/roles/change-roles-screen.react.js b/native/roles/change-roles-screen.react.js --- a/native/roles/change-roles-screen.react.js +++ b/native/roles/change-roles-screen.react.js @@ -3,7 +3,7 @@ import { useActionSheet } from '@expo/react-native-action-sheet'; import invariant from 'invariant'; import * as React from 'react'; -import { View, Text, Platform, ActivityIndicator } from 'react-native'; +import { ActivityIndicator, Platform, Text, View } from 'react-native'; import { TouchableOpacity } from 'react-native-gesture-handler'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; @@ -12,7 +12,11 @@ import { otherUsersButNoOtherAdmins } from 'lib/selectors/thread-selectors.js'; import { roleIsAdminRole } from 'lib/shared/thread-utils.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { RelativeMemberInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + RelativeMemberInfo, +} from 'lib/types/thread-types.js'; import { values } from 'lib/utils/objects.js'; import ChangeRolesHeaderRightButton from './change-roles-header-right-button.react.js'; @@ -24,7 +28,7 @@ import { useStyles } from '../themes/colors.js'; export type ChangeRolesScreenParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +memberInfo: RelativeMemberInfo, +role: ?string, }; diff --git a/native/roles/community-roles-screen.react.js b/native/roles/community-roles-screen.react.js --- a/native/roles/community-roles-screen.react.js +++ b/native/roles/community-roles-screen.react.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; @@ -9,7 +9,8 @@ useRoleMemberCountsForCommunity, useRoleUserSurfacedPermissions, } from 'lib/shared/thread-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import RolePanelEntry from './role-panel-entry.react.js'; import type { RolesNavigationProp } from './roles-navigator.react.js'; @@ -20,7 +21,7 @@ import { useStyles } from '../themes/colors.js'; export type CommunityRolesScreenParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type CommunityRolesScreenProps = { @@ -37,9 +38,8 @@ // manually pull in the threadInfo from the redux store, since the threadInfo // passed into the route params will not be updated automatically. const threadID = threadInfo.id; - const reduxThreadInfo: ?ThreadInfo = useSelector( - state => threadInfoSelector(state)[threadID], - ); + const reduxThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo = + useSelector(state => threadInfoSelector(state)[threadID]); const { setParams } = props.navigation; React.useEffect(() => { diff --git a/native/roles/create-roles-screen.react.js b/native/roles/create-roles-screen.react.js --- a/native/roles/create-roles-screen.react.js +++ b/native/roles/create-roles-screen.react.js @@ -1,18 +1,19 @@ // @flow import * as React from 'react'; -import { View, Text, TouchableOpacity, ActivityIndicator } from 'react-native'; +import { ActivityIndicator, Text, TouchableOpacity, View } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import { modifyCommunityRoleActionTypes } 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 { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { - type UserSurfacedPermissionOption, type UserSurfacedPermission, + type UserSurfacedPermissionOption, userSurfacedPermissionOptions, } from 'lib/types/thread-permission-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import CreateRolesHeaderRightButton from './create-roles-header-right-button.react.js'; import type { RolesNavigationProp } from './roles-navigator.react.js'; @@ -24,7 +25,7 @@ import { useStyles } from '../themes/colors.js'; export type CreateRolesScreenParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +action: 'create_role' | 'edit_role', +existingRoleID?: string, +roleName: string, diff --git a/native/roles/role-panel-entry.react.js b/native/roles/role-panel-entry.react.js --- a/native/roles/role-panel-entry.react.js +++ b/native/roles/role-panel-entry.react.js @@ -3,11 +3,12 @@ import { useActionSheet } from '@expo/react-native-action-sheet'; import invariant from 'invariant'; import * as React from 'react'; -import { View, Text, TouchableOpacity, Platform } from 'react-native'; +import { Platform, Text, TouchableOpacity, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { UserSurfacedPermission } from 'lib/types/thread-permission-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useDisplayDeleteRoleAlert } from './role-utils.react.js'; import type { RolesNavigationProp } from './roles-navigator.react.js'; @@ -19,7 +20,7 @@ type RolePanelEntryProps = { +navigation: RolesNavigationProp<'CommunityRolesScreen'>, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +roleName: string, +rolePermissions: $ReadOnlySet, +memberCount: number, diff --git a/native/roles/role-utils.react.js b/native/roles/role-utils.react.js --- a/native/roles/role-utils.react.js +++ b/native/roles/role-utils.react.js @@ -3,17 +3,18 @@ import * as React from 'react'; import { - useDeleteCommunityRole, deleteCommunityRoleActionTypes, + useDeleteCommunityRole, } from 'lib/actions/thread-actions.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 { constructRoleDeletionMessagePrompt } from 'lib/utils/role-utils.js'; import Alert from '../utils/alert.js'; function useDisplayDeleteRoleAlert( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, existingRoleID: string, defaultRoleID: string, memberCount: number, 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 @@ -8,11 +8,12 @@ import { messageListData } from 'lib/selectors/chat-selectors.js'; import { createMessageInfo } from 'lib/shared/message-utils.js'; import { - useSearchMessages, filterChatMessageInfosForSearch, + useSearchMessages, } from 'lib/shared/search-utils.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -28,7 +29,7 @@ import type { VerticalBounds } from '../types/layout-types.js'; export type MessageSearchParams = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; 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 @@ -2,7 +2,8 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -11,7 +12,7 @@ import { useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +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 @@ -8,7 +8,8 @@ } from 'lib/selectors/thread-selectors.js'; import { isLoggedIn } from 'lib/selectors/user-selectors.js'; import type { EntryInfo } from 'lib/types/entry-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -32,7 +33,7 @@ | { itemType: 'entryInfo', entryInfo: EntryInfo, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; const calendarListData: (state: AppState) => ?(CalendarItem[]) = createSelector( @@ -42,7 +43,9 @@ ( loggedIn: boolean, daysToEntries: { +[dayString: string]: EntryInfo[] }, - threadInfos: { +[id: string]: ThreadInfo }, + threadInfos: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, ) => { if (!loggedIn || daysToEntries[dateString(new Date())] === undefined) { return null; 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 @@ -7,7 +7,8 @@ RobotextMessageInfo, } from 'lib/types/message-types.js'; import type { TextMessageInfo } from 'lib/types/messages/text.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -16,12 +17,12 @@ +itemType: 'message', +messageShapeType: 'robotext', +messageInfo: RobotextMessageInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +startsConversation: boolean, +startsCluster: boolean, +endsCluster: boolean, +robotext: EntityText, - +threadCreatedFromMessage: ?ThreadInfo, + +threadCreatedFromMessage: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +contentHeight: number, +reactions: ReactionInfo, }; @@ -31,12 +32,12 @@ +messageShapeType: 'text', +messageInfo: TextMessageInfo, +localMessageInfo: ?LocalMessageInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +startsConversation: boolean, +startsCluster: boolean, +endsCluster: boolean, +contentHeight: number, - +threadCreatedFromMessage: ?ThreadInfo, + +threadCreatedFromMessage: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +reactions: ReactionInfo, +hasBeenEdited: ?boolean, +isPinned: ?boolean, @@ -56,11 +57,11 @@ +messageShapeType: 'multimedia', +messageInfo: MultimediaMessageInfo, +localMessageInfo: ?LocalMessageInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +startsConversation: boolean, +startsCluster: boolean, +endsCluster: boolean, - +threadCreatedFromMessage: ?ThreadInfo, + +threadCreatedFromMessage: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +pendingUploads: ?MessagePendingUploads, +reactions: ReactionInfo, +hasBeenEdited: ?boolean, diff --git a/native/user-profile/user-profile-menu-button.react.js b/native/user-profile/user-profile-menu-button.react.js --- a/native/user-profile/user-profile-menu-button.react.js +++ b/native/user-profile/user-profile-menu-button.react.js @@ -3,11 +3,12 @@ import { useNavigation, useRoute } from '@react-navigation/native'; import invariant from 'invariant'; import * as React from 'react'; -import { View, TouchableOpacity } from 'react-native'; +import { TouchableOpacity, View } from 'react-native'; import { useRelationshipPrompt } from 'lib/hooks/relationship-prompt.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from 'lib/types/relationship-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { UserInfo } from 'lib/types/user-types'; import { userProfileMenuButtonHeight } from './user-profile-constants.js'; @@ -21,7 +22,7 @@ const onMenuButtonLayout = () => {}; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +pendingPersonalThreadUserInfo: ?UserInfo, }; 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 @@ -4,7 +4,8 @@ import * as React from 'react'; import { Text } from 'react-native'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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'; @@ -13,7 +14,7 @@ import { useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +pendingPersonalThreadUserInfo?: UserInfo, }; diff --git a/native/user-profile/user-profile-relationship-button.react.js b/native/user-profile/user-profile-relationship-button.react.js --- a/native/user-profile/user-profile-relationship-button.react.js +++ b/native/user-profile/user-profile-relationship-button.react.js @@ -1,12 +1,13 @@ // @flow import * as React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import { useRelationshipPrompt } from 'lib/hooks/relationship-prompt.js'; import type { SetState } from 'lib/types/hook-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from 'lib/types/relationship-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { UserInfo } from 'lib/types/user-types'; import { userProfileActionButtonHeight } from './user-profile-constants.js'; @@ -19,7 +20,7 @@ }; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +pendingPersonalThreadUserInfo?: UserInfo, +setUserProfileRelationshipButtonHeight: SetState, }; 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 @@ -1,13 +1,14 @@ // @flow +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypeIsCommunityRoot } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.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: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +hasSubchannelsButton: boolean, +labelStyle: TextStyle, +hasChildren: boolean, diff --git a/web/avatars/edit-thread-avatar-menu.react.js b/web/avatars/edit-thread-avatar-menu.react.js --- a/web/avatars/edit-thread-avatar-menu.react.js +++ b/web/avatars/edit-thread-avatar-menu.react.js @@ -6,8 +6,11 @@ import { EditThreadAvatarContext } from 'lib/components/base-edit-thread-avatar-provider.react.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; -import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useUploadAvatarMedia } from './avatar-hooks.react.js'; import css from './edit-avatar-menu.css'; @@ -23,7 +26,7 @@ ); type Props = { - +threadInfo: RawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function EditThreadAvatarMenu(props: Props): React.Node { const { threadInfo } = props; diff --git a/web/avatars/edit-thread-avatar.react.js b/web/avatars/edit-thread-avatar.react.js --- a/web/avatars/edit-thread-avatar.react.js +++ b/web/avatars/edit-thread-avatar.react.js @@ -5,16 +5,19 @@ import { EditThreadAvatarContext } from 'lib/components/base-edit-thread-avatar-provider.react.js'; import { threadHasPermission } from 'lib/shared/thread-utils.js'; -import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import EditThreadAvatarMenu from './edit-thread-avatar-menu.react.js'; import css from './edit-thread-avatar.css'; import ThreadAvatar from './thread-avatar.react.js'; type Props = { - +threadInfo: RawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, +disabled?: boolean, }; function EditThreadAvatar(props: Props): React.Node { diff --git a/web/avatars/thread-avatar.react.js b/web/avatars/thread-avatar.react.js --- a/web/avatars/thread-avatar.react.js +++ b/web/avatars/thread-avatar.react.js @@ -8,15 +8,18 @@ } from 'lib/shared/avatar-utils.js'; import { getSingleOtherUser } from 'lib/shared/thread-utils.js'; import type { AvatarSize } from 'lib/types/avatar-types.js'; -import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import Avatar from './avatar.react.js'; import { useSelector } from '../redux/redux-utils.js'; type Props = { - +threadInfo: RawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, +size: AvatarSize, +showSpinner?: boolean, }; diff --git a/web/avatars/thread-emoji-avatar-selection-modal.react.js b/web/avatars/thread-emoji-avatar-selection-modal.react.js --- a/web/avatars/thread-emoji-avatar-selection-modal.react.js +++ b/web/avatars/thread-emoji-avatar-selection-modal.react.js @@ -12,13 +12,16 @@ ClientAvatar, ClientEmojiAvatar, } from 'lib/types/avatar-types.js'; -import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + RawThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import EmojiAvatarSelectionModal from './emoji-avatar-selection-modal.react.js'; type Props = { - +threadInfo: RawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ThreadEmojiAvatarSelectionModal(props: Props): React.Node { diff --git a/web/calendar/day.react.js b/web/calendar/day.react.js --- a/web/calendar/day.react.js +++ b/web/calendar/day.react.js @@ -10,15 +10,16 @@ createLocalEntryActionType, } from 'lib/actions/entry-actions.js'; import { - useModalContext, type PushModal, + useModalContext, } from 'lib/components/modal-provider.react.js'; import { onScreenThreadInfos as onScreenThreadInfosSelector } from 'lib/selectors/thread-selectors.js'; import { entryKey } from 'lib/shared/entry-utils.js'; import type { EntryInfo } from 'lib/types/entry-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { Dispatch } from 'lib/types/redux-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; -import { dateString, dateFromString } from 'lib/utils/date-utils.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; +import { dateFromString, dateString } from 'lib/utils/date-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import css from './calendar.css'; @@ -38,7 +39,9 @@ }; type Props = { ...BaseProps, - +onScreenThreadInfos: $ReadOnlyArray, + +onScreenThreadInfos: $ReadOnlyArray< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + >, +viewerID: ?string, +loggedIn: boolean, +nextLocalID: number, diff --git a/web/chat/chat-input-bar.react.js b/web/chat/chat-input-bar.react.js --- a/web/chat/chat-input-bar.react.js +++ b/web/chat/chat-input-bar.react.js @@ -6,8 +6,8 @@ import { joinThreadActionTypes, - useJoinThread, newThreadActionTypes, + useJoinThread, } from 'lib/actions/thread-actions.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { @@ -18,33 +18,34 @@ import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { getTypeaheadRegexMatches, - useUserMentionsCandidates, - useMentionTypeaheadChatSuggestions, type MentionTypeaheadSuggestionItem, type TypeaheadMatchedStrings, + useMentionTypeaheadChatSuggestions, useMentionTypeaheadUserSuggestions, + useUserMentionsCandidates, } from 'lib/shared/mention-utils.js'; import { localIDPrefix, trimMessage } from 'lib/shared/message-utils.js'; import { + checkIfDefaultMembersAreVoiced, + threadActualMembers, + threadFrozenDueToViewerBlock, threadHasPermission, viewerIsMember, - threadFrozenDueToViewerBlock, - threadActualMembers, - checkIfDefaultMembersAreVoiced, } from 'lib/shared/thread-utils.js'; import type { CalendarQuery } from 'lib/types/entry-types.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; import { type ClientThreadJoinRequest, type ThreadJoinPayload, - type ThreadInfo, + type LegacyThreadInfo, } from 'lib/types/thread-types.js'; import { type UserInfos } from 'lib/types/user-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import css from './chat-input-bar.css'; @@ -60,13 +61,13 @@ import { useSelector } from '../redux/redux-utils.js'; import { nonThreadCalendarQuery } from '../selectors/nav-selectors.js'; import { - webMentionTypeaheadRegex, getMentionTypeaheadTooltipActions, getMentionTypeaheadTooltipButtons, + webMentionTypeaheadRegex, } from '../utils/typeahead-utils.js'; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +inputState: InputState, }; type Props = { @@ -82,7 +83,7 @@ +joinThread: (request: ClientThreadJoinRequest) => Promise, +typeaheadMatchedStrings: ?TypeaheadMatchedStrings, +suggestions: $ReadOnlyArray, - +parentThreadInfo: ?ThreadInfo, + +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; class ChatInputBar extends React.PureComponent { diff --git a/web/chat/chat-message-list.react.js b/web/chat/chat-message-list.react.js --- a/web/chat/chat-message-list.react.js +++ b/web/chat/chat-message-list.react.js @@ -6,16 +6,16 @@ import _debounce from 'lodash/debounce.js'; import * as React from 'react'; +import type { + FetchMessagesBeforeCursorInput, + FetchMostRecentMessagesInput, +} from 'lib/actions/message-actions.js'; import { fetchMessagesBeforeCursorActionTypes, - useFetchMessagesBeforeCursor, fetchMostRecentMessagesActionTypes, + useFetchMessagesBeforeCursor, useFetchMostRecentMessages, } from 'lib/actions/message-actions.js'; -import type { - FetchMostRecentMessagesInput, - FetchMessagesBeforeCursorInput, -} from 'lib/actions/message-actions.js'; import { useThreadChatMentionCandidates } from 'lib/hooks/chat-mention-hooks.js'; import { useOldestMessageServerID } from 'lib/hooks/message-hooks.js'; import { registerFetchKey } from 'lib/reducers/loading-reducer.js'; @@ -26,14 +26,15 @@ import { messageKey } from 'lib/shared/message-utils.js'; import { threadIsPending } from 'lib/shared/thread-utils.js'; import type { FetchMessageInfosPayload } from 'lib/types/message-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { - useDispatchActionPromise, type DispatchActionPromise, + useDispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; -import { editBoxHeight, defaultMaxTextAreaHeight } from './chat-constants.js'; +import { defaultMaxTextAreaHeight, editBoxHeight } from './chat-constants.js'; import css from './chat-message-list.css'; import type { ScrollToMessageCallback } from './edit-message-provider.js'; import { useEditModalContext } from './edit-message-provider.js'; @@ -55,7 +56,7 @@ const editBoxTopMargin = 10; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { diff --git a/web/chat/chat-thread-list-item-menu.react.js b/web/chat/chat-thread-list-item-menu.react.js --- a/web/chat/chat-thread-list-item-menu.react.js +++ b/web/chat/chat-thread-list-item-menu.react.js @@ -5,14 +5,15 @@ import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import useToggleUnreadStatus from 'lib/hooks/toggle-unread-status.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './chat-thread-list-item-menu.css'; import Button from '../components/button.react.js'; import { useThreadIsActive } from '../selectors/thread-selectors.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +mostRecentNonLocalMessage: ?string, +renderStyle?: 'chat' | 'thread', }; diff --git a/web/chat/chat-thread-list-see-more-sidebars.react.js b/web/chat/chat-thread-list-see-more-sidebars.react.js --- a/web/chat/chat-thread-list-see-more-sidebars.react.js +++ b/web/chat/chat-thread-list-see-more-sidebars.react.js @@ -5,13 +5,14 @@ import { IoIosMore } from 'react-icons/io/index.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './chat-thread-list.css'; import SidebarsModal from '../modals/threads/sidebars/sidebars-modal.react.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +unread: boolean, }; function ChatThreadListSeeMoreSidebars(props: Props): React.Node { diff --git a/web/chat/composed-message.react.js b/web/chat/composed-message.react.js --- a/web/chat/composed-message.react.js +++ b/web/chat/composed-message.react.js @@ -3,8 +3,8 @@ import classNames from 'classnames'; import * as React from 'react'; import { - Circle as CircleIcon, CheckCircle as CheckCircleIcon, + Circle as CircleIcon, XCircle as XCircleIcon, } from 'react-feather'; @@ -12,7 +12,8 @@ import { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; import { getMessageLabel } from 'lib/shared/edit-messages-utils.js'; import { assertComposableMessageType } from 'lib/types/message-types.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { getComposedMessageID } from './chat-constants.js'; import css from './chat-message-list.css'; @@ -50,7 +51,7 @@ type BaseProps = { +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +shouldDisplayPinIndicator: boolean, +sendFailed: boolean, +children: React.Node, diff --git a/web/chat/edit-message-provider.js b/web/chat/edit-message-provider.js --- a/web/chat/edit-message-provider.js +++ b/web/chat/edit-message-provider.js @@ -5,7 +5,8 @@ import ModalOverlay from 'lib/components/modal-overlay.react.js'; import type { ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; -import type { ThreadInfo } from 'lib/types/thread-types'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types'; import { EditTextMessage } from './edit-text-message.react.js'; @@ -18,7 +19,7 @@ export type EditState = { +messageInfo: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +editedMessageDraft: ?string, +isError: boolean, +position?: ModalPosition, diff --git a/web/chat/edit-text-message.react.js b/web/chat/edit-text-message.react.js --- a/web/chat/edit-text-message.react.js +++ b/web/chat/edit-text-message.react.js @@ -8,7 +8,8 @@ import type { ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; import { useEditMessage } from 'lib/shared/edit-messages-utils.js'; import { trimMessage } from 'lib/shared/message-utils.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { editBoxBottomRowHeight } from './chat-constants.js'; import ChatInputTextArea from './chat-input-text-area.react.js'; @@ -20,7 +21,7 @@ type Props = { +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +background: boolean, }; diff --git a/web/chat/failed-send.react.js b/web/chat/failed-send.react.js --- a/web/chat/failed-send.react.js +++ b/web/chat/failed-send.react.js @@ -8,10 +8,11 @@ import { messageID } from 'lib/shared/message-utils.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import { - type RawComposableMessageInfo, assertComposableMessageType, + type RawComposableMessageInfo, } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './chat-message-list.css'; import multimediaMessageSendFailed from './multimedia-message-send-failed.js'; @@ -22,13 +23,13 @@ type BaseProps = { +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; type Props = { ...BaseProps, +rawMessageInfo: RawComposableMessageInfo, +inputState: ?InputState, - +parentThreadInfo: ?ThreadInfo, + +parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; class FailedSend extends React.PureComponent { retryingText = false; diff --git a/web/chat/inline-engagement.react.js b/web/chat/inline-engagement.react.js --- a/web/chat/inline-engagement.react.js +++ b/web/chat/inline-engagement.react.js @@ -7,7 +7,8 @@ import type { ReactionInfo } from 'lib/selectors/chat-selectors.js'; import { getInlineEngagementSidebarText } from 'lib/shared/inline-engagement-utils.js'; import type { MessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './inline-engagement.css'; import ReactionPill from './reaction-pill.react.js'; @@ -16,8 +17,8 @@ type Props = { +messageInfo: MessageInfo, - +threadInfo: ThreadInfo, - +sidebarThreadInfo: ?ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + +sidebarThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +reactions: ReactionInfo, +positioning: 'left' | 'center' | 'right', +label?: ?string, diff --git a/web/chat/message-preview.react.js b/web/chat/message-preview.react.js --- a/web/chat/message-preview.react.js +++ b/web/chat/message-preview.react.js @@ -7,14 +7,15 @@ import { useThreadChatMentionCandidates } from 'lib/hooks/chat-mention-hooks.js'; import { useMessagePreview } from 'lib/shared/message-utils.js'; import { type MessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './chat-thread-list.css'; import { getDefaultTextMessageRules } from '../markdown/rules.react.js'; type Props = { +messageInfo: ?MessageInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function MessagePreview(props: Props): React.Node { const { messageInfo, threadInfo } = props; diff --git a/web/chat/message.react.js b/web/chat/message.react.js --- a/web/chat/message.react.js +++ b/web/chat/message.react.js @@ -5,7 +5,8 @@ import { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 css from './chat-message-list.css'; @@ -17,7 +18,7 @@ type Props = { +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +shouldDisplayPinIndicator: boolean, }; function Message(props: Props): React.Node { diff --git a/web/chat/multimedia-message.react.js b/web/chat/multimedia-message.react.js --- a/web/chat/multimedia-message.react.js +++ b/web/chat/multimedia-message.react.js @@ -9,16 +9,18 @@ } from 'lib/media/media-utils.js'; import { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './chat-message-list.css'; import ComposedMessage from './composed-message.react.js'; import sendFailed from './multimedia-message-send-failed.js'; import { type InputState, InputStateContext } from '../input/input-state.js'; import Multimedia from '../media/multimedia.react.js'; + type BaseProps = { +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +shouldDisplayPinIndicator: boolean, }; type Props = { diff --git a/web/chat/pinned-messages-banner.react.js b/web/chat/pinned-messages-banner.react.js --- a/web/chat/pinned-messages-banner.react.js +++ b/web/chat/pinned-messages-banner.react.js @@ -4,7 +4,8 @@ import { ChevronRight } from 'react-feather'; import { useModalContext } from 'lib/components/modal-provider.react.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { pinnedMessageCountText } from 'lib/utils/message-pinning-utils.js'; import css from './pinned-messages-banner.css'; @@ -12,7 +13,7 @@ import PinnedMessagesModal from '../modals/chat/pinned-messages-modal.react.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function PinnedMessagesBanner(props: Props): React.Node { diff --git a/web/chat/relationship-prompt/relationship-prompt.js b/web/chat/relationship-prompt/relationship-prompt.js --- a/web/chat/relationship-prompt/relationship-prompt.js +++ b/web/chat/relationship-prompt/relationship-prompt.js @@ -9,14 +9,15 @@ import * as React from 'react'; import { useRelationshipPrompt } from 'lib/hooks/relationship-prompt.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from 'lib/types/relationship-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import RelationshipPromptButtonContainer from './relationship-prompt-button-container.js'; import RelationshipPromptButton from './relationship-prompt-button.js'; import { buttonThemes } from '../../components/button.react.js'; -type Props = { +threadInfo: ThreadInfo }; +type Props = { +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo }; function RelationshipPrompt(props: Props) { const { threadInfo } = props; diff --git a/web/chat/robotext-message.react.js b/web/chat/robotext-message.react.js --- a/web/chat/robotext-message.react.js +++ b/web/chat/robotext-message.react.js @@ -5,8 +5,9 @@ import { type RobotextChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { Dispatch } from 'lib/types/redux-types.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { entityTextToReact, useENSNamesForEntityText, @@ -34,7 +35,7 @@ type Props = { +item: RobotextChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function RobotextMessage(props: Props): React.Node { let inlineEngagement; @@ -100,7 +101,7 @@ }; type InnerThreadEntityProps = { ...BaseInnerThreadEntityProps, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +dispatch: Dispatch, }; class InnerThreadEntity extends React.PureComponent { diff --git a/web/chat/text-message.react.js b/web/chat/text-message.react.js --- a/web/chat/text-message.react.js +++ b/web/chat/text-message.react.js @@ -8,7 +8,8 @@ import { colorIsDark } from 'lib/shared/color-utils.js'; import { onlyEmojiRegex } from 'lib/shared/emojis.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './chat-message-list.css'; import ComposedMessage from './composed-message.react.js'; @@ -18,7 +19,7 @@ type Props = { +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +shouldDisplayPinIndicator: boolean, }; function TextMessage(props: Props): React.Node { diff --git a/web/chat/thread-menu.react.js b/web/chat/thread-menu.react.js --- a/web/chat/thread-menu.react.js +++ b/web/chat/thread-menu.react.js @@ -3,8 +3,8 @@ import * as React from 'react'; import { - useLeaveThread, leaveThreadActionTypes, + useLeaveThread, } from 'lib/actions/thread-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; @@ -12,12 +12,13 @@ import { childThreadInfos } from 'lib/selectors/thread-selectors.js'; import { threadHasPermission, - viewerIsMember, threadIsChannel, + viewerIsMember, } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import css from './thread-menu.css'; @@ -35,7 +36,7 @@ import { useSelector } from '../redux/redux-utils.js'; type ThreadMenuProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ThreadMenu(props: ThreadMenuProps): React.Node { diff --git a/web/chat/thread-top-bar.react.js b/web/chat/thread-top-bar.react.js --- a/web/chat/thread-top-bar.react.js +++ b/web/chat/thread-top-bar.react.js @@ -5,7 +5,8 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { threadIsPending } from 'lib/shared/thread-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 PinnedMessagesBanner from './pinned-messages-banner.react.js'; @@ -17,7 +18,7 @@ import MessageSearchModal from '../modals/search/message-search-modal.react.js'; type ThreadTopBarProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ThreadTopBar(props: ThreadTopBarProps): React.Node { const { threadInfo } = props; diff --git a/web/components/message-result.react.js b/web/components/message-result.react.js --- a/web/components/message-result.react.js +++ b/web/components/message-result.react.js @@ -6,7 +6,8 @@ import { useThreadChatMentionCandidates } from 'lib/hooks/chat-mention-hooks.js'; import { useStringForUser } from 'lib/hooks/ens-cache.js'; import type { ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 css from './message-result.css'; @@ -16,7 +17,7 @@ type MessageResultProps = { +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +scrollable: boolean, }; diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js --- a/web/input/input-state-container.react.js +++ b/web/input/input-state-container.react.js @@ -10,32 +10,32 @@ import * as React from 'react'; import { createSelector } from 'reselect'; +import type { + LegacySendMultimediaMessageInput, + SendTextMessageInput, +} from 'lib/actions/message-actions.js'; import { createLocalMessageActionType, sendMultimediaMessageActionTypes, - useLegacySendMultimediaMessage, sendTextMessageActionTypes, + useLegacySendMultimediaMessage, useSendTextMessage, } from 'lib/actions/message-actions.js'; -import type { - LegacySendMultimediaMessageInput, - SendTextMessageInput, -} from 'lib/actions/message-actions.js'; import { queueReportsActionType } from 'lib/actions/report-actions.js'; import { useNewThread } from 'lib/actions/thread-actions.js'; import { - uploadMultimedia, - updateMultimediaMessageMediaActionType, - useDeleteUpload, - useBlobServiceUpload, - type MultimediaUploadCallbacks, - type MultimediaUploadExtras, type BlobServiceUploadAction, type DeleteUploadInput, + type MultimediaUploadCallbacks, + type MultimediaUploadExtras, + updateMultimediaMessageMediaActionType, + uploadMultimedia, + useBlobServiceUpload, + useDeleteUpload, } from 'lib/actions/upload-actions.js'; import { - useModalContext, type PushModal, + useModalContext, } from 'lib/components/modal-provider.react.js'; import blobService from 'lib/facts/blob-service.js'; import commStaffCommunity from 'lib/facts/comm-staff-community.js'; @@ -50,66 +50,67 @@ import { createRealThreadFromPendingThread, draftKeyFromThreadID, - threadIsPending, - threadIsPendingSidebar, patchThreadInfoToIncludeMentionedMembersOfParent, threadInfoInsideCommunity, + threadIsPending, + threadIsPendingSidebar, } from 'lib/shared/thread-utils.js'; import type { CalendarQuery } from 'lib/types/entry-types.js'; import type { - UploadMultimediaResult, - MediaMissionStep, + MediaMission, MediaMissionFailure, MediaMissionResult, - MediaMission, + MediaMissionStep, + UploadMultimediaResult, } from 'lib/types/media-types.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import { type RawMessageInfo, type RawMultimediaMessageInfo, - type SendMessageResult, type SendMessagePayload, + type SendMessageResult, } from 'lib/types/message-types.js'; import type { RawImagesMessageInfo } from 'lib/types/messages/images.js'; import type { RawMediaMessageInfo } from 'lib/types/messages/media.js'; import type { RawTextMessageInfo } from 'lib/types/messages/text.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { Dispatch } from 'lib/types/redux-types.js'; import { reportTypes } from 'lib/types/report-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; import { type ClientNewThreadRequest, type NewThreadResult, - type ThreadInfo, + type LegacyThreadInfo, } from 'lib/types/thread-types.js'; import { useServerCall } from 'lib/utils/action-utils.js'; import { - makeBlobServiceEndpointURL, - isBlobServiceURI, blobHashFromBlobServiceURI, + isBlobServiceURI, + makeBlobServiceEndpointURL, } from 'lib/utils/blob-service.js'; import { getConfig } from 'lib/utils/config.js'; -import { getMessageForException, cloneError } from 'lib/utils/errors.js'; +import { cloneError, getMessageForException } 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 { generateReportID } from 'lib/utils/report-utils.js'; import { - type PendingMultimediaUpload, - type TypeaheadState, - InputStateContext, type BaseInputState, - type TypeaheadInputState, type InputState, + InputStateContext, + type PendingMultimediaUpload, + type TypeaheadInputState, + type TypeaheadState, } from './input-state.js'; import { encryptFile } from '../media/encryption-utils.js'; import { generateThumbHash } from '../media/image-utils.js'; import { + preloadImage, preloadMediaResource, validateFile, - preloadImage, } from '../media/media-utils.js'; import InvalidUploadModal from '../modals/chat/invalid-upload.react.js'; import { updateNavInfoActionType } from '../redux/action-types.js'; @@ -419,7 +420,9 @@ return rawMessageInfo; } - shouldEncryptMedia(threadInfo: ThreadInfo): boolean { + shouldEncryptMedia( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ): boolean { return threadInfoInsideCommunity(threadInfo, commStaffCommunity.id); } @@ -565,7 +568,9 @@ } } - startThreadCreation(threadInfo: ThreadInfo): Promise { + startThreadCreation( + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ): Promise { if (!threadIsPending(threadInfo.id)) { return Promise.resolve(threadInfo.id); } @@ -626,20 +631,20 @@ draft: draft ?? '', textCursorPosition: textCursorPosition ?? 0, appendFiles: ( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, files: $ReadOnlyArray, ) => this.appendFiles(threadInfo, files), cancelPendingUpload: (localUploadID: string) => this.cancelPendingUpload(threadID, localUploadID), sendTextMessage: ( messageInfo: RawTextMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => this.sendTextMessage(messageInfo, threadInfo, parentThreadInfo), createMultimediaMessage: ( localID: number, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ) => this.createMultimediaMessage(localID, threadInfo), setDraft: (newDraft: string) => this.setDraft(threadID, newDraft), setTextCursorPosition: (newPosition: number) => @@ -648,7 +653,7 @@ this.messageHasUploadFailure(assignedUploads[localMessageID]), retryMultimediaMessage: ( localMessageID: string, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ) => this.retryMultimediaMessage( localMessageID, @@ -687,7 +692,7 @@ } async appendFiles( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, files: $ReadOnlyArray, ): Promise { const selectionTime = Date.now(); @@ -744,7 +749,7 @@ } async appendFile( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, file: File, selectTime: number, ): Promise<{ @@ -1241,8 +1246,8 @@ async sendTextMessage( messageInfo: RawTextMessageInfo, - inputThreadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + inputThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) { this.props.sendCallbacks.forEach(callback => callback()); @@ -1339,8 +1344,8 @@ async sendTextMessageAction( messageInfo: RawTextMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): Promise { try { await this.props.textMessageCreationSideEffectsFunc( @@ -1379,7 +1384,10 @@ // Creates a MultimediaMessage from the unassigned pending uploads, // if there are any - createMultimediaMessage(localID: number, threadInfo: ThreadInfo) { + createMultimediaMessage( + localID: number, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) { this.props.sendCallbacks.forEach(callback => callback()); const localMessageID = `${localIDPrefix}${localID}`; @@ -1500,7 +1508,7 @@ retryMultimediaMessage( localMessageID: string, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, pendingUploads: ?$ReadOnlyArray, ) { this.props.sendCallbacks.forEach(callback => callback()); diff --git a/web/input/input-state.js b/web/input/input-state.js --- a/web/input/input-state.js +++ b/web/input/input-state.js @@ -3,16 +3,17 @@ import * as React from 'react'; import { - type MediaType, - type EncryptedMediaType, type Dimensions, + type EncryptedMediaType, type MediaMissionStep, + type MediaType, } from 'lib/types/media-types.js'; import type { RawTextMessageInfo } from 'lib/types/messages/text.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ChatMentionCandidates, + LegacyThreadInfo, RelativeMemberInfo, - ThreadInfo, } from 'lib/types/thread-types.js'; export type PendingMultimediaUpload = { @@ -63,22 +64,25 @@ +draft: string, +textCursorPosition: number, +appendFiles: ( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, files: $ReadOnlyArray, ) => Promise, +cancelPendingUpload: (localUploadID: string) => void, +sendTextMessage: ( messageInfo: RawTextMessageInfo, - threadInfo: ThreadInfo, - parentThreadInfo: ?ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + parentThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ) => mixed, - +createMultimediaMessage: (localID: number, threadInfo: ThreadInfo) => void, + +createMultimediaMessage: ( + localID: number, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + ) => void, +setDraft: (draft: string) => void, +setTextCursorPosition: (newPosition: number) => void, +messageHasUploadFailure: (localMessageID: string) => boolean, +retryMultimediaMessage: ( localMessageID: string, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ) => void, +addReply: (text: string) => void, +addReplyListener: ((message: string) => void) => void, diff --git a/web/invite-links/manage/edit-link-modal.react.js b/web/invite-links/manage/edit-link-modal.react.js --- a/web/invite-links/manage/edit-link-modal.react.js +++ b/web/invite-links/manage/edit-link-modal.react.js @@ -11,7 +11,8 @@ inviteLinkErrorMessages, } from 'lib/shared/invite-links.js'; import type { InviteLink } from 'lib/types/link-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './manage-invite-links-modal.css'; import Button from '../../components/button.react.js'; @@ -22,7 +23,7 @@ +inviteLink: ?InviteLink, +enterViewMode: () => mixed, +enterDisableMode: () => mixed, - +community: ThreadInfo, + +community: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; const disableButtonColor = { diff --git a/web/markdown/rules.react.js b/web/markdown/rules.react.js --- a/web/markdown/rules.react.js +++ b/web/markdown/rules.react.js @@ -6,9 +6,10 @@ import * as SharedMarkdown from 'lib/shared/markdown.js'; import { chatMentionRegex } from 'lib/shared/mention-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ChatMentionCandidates, - ThreadInfo, + LegacyThreadInfo, } from 'lib/types/thread-types.js'; import MarkdownChatMention from './markdown-chat-mention.react.js'; @@ -161,7 +162,7 @@ }); function useTextMessageRulesFunc( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, chatMentionCandidates: ChatMentionCandidates, ): boolean => MarkdownRules { const { members } = threadInfo; diff --git a/web/modals/chat/pinned-messages-modal.react.js b/web/modals/chat/pinned-messages-modal.react.js --- a/web/modals/chat/pinned-messages-modal.react.js +++ b/web/modals/chat/pinned-messages-modal.react.js @@ -8,8 +8,8 @@ } from 'lib/actions/message-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import { - messageListData, type ChatMessageInfoItem, + messageListData, } from 'lib/selectors/chat-selectors.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { @@ -18,7 +18,8 @@ modifyItemForResultScreen, } from 'lib/shared/message-utils.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { pinnedMessageCountText } from 'lib/utils/message-pinning-utils.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; @@ -29,7 +30,7 @@ import Modal from '../modal.react.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; const loadingStatusSelector = createLoadingStatusSelector( diff --git a/web/modals/chat/sidebar-promote-modal.react.js b/web/modals/chat/sidebar-promote-modal.react.js --- a/web/modals/chat/sidebar-promote-modal.react.js +++ b/web/modals/chat/sidebar-promote-modal.react.js @@ -2,7 +2,8 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 css from './sidebar-promote-modal.css'; @@ -12,7 +13,7 @@ type Props = { +onClose: () => void, +onConfirm: () => void, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function SidebarPromoteModal(props: Props): React.Node { diff --git a/web/modals/chat/toggle-pin-modal.react.js b/web/modals/chat/toggle-pin-modal.react.js --- a/web/modals/chat/toggle-pin-modal.react.js +++ b/web/modals/chat/toggle-pin-modal.react.js @@ -4,14 +4,15 @@ import * as React from 'react'; import { - useToggleMessagePin, toggleMessagePinActionTypes, + useToggleMessagePin, } from 'lib/actions/message-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import type { ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; import { modifyItemForResultScreen } from 'lib/shared/message-utils.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 css from './toggle-pin-modal.css'; @@ -21,7 +22,7 @@ type TogglePinModalProps = { +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function TogglePinModal(props: TogglePinModalProps): React.Node { diff --git a/web/modals/search/message-search-modal.react.js b/web/modals/search/message-search-modal.react.js --- a/web/modals/search/message-search-modal.react.js +++ b/web/modals/search/message-search-modal.react.js @@ -4,7 +4,8 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import type { ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 css from './message-search-modal.css'; @@ -18,7 +19,7 @@ import Modal from '../modal.react.js'; type ContentProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function MessageSearchModal(props: ContentProps): React.Node { diff --git a/web/modals/search/message-search-utils.react.js b/web/modals/search/message-search-utils.react.js --- a/web/modals/search/message-search-utils.react.js +++ b/web/modals/search/message-search-utils.react.js @@ -2,20 +2,23 @@ import * as React from 'react'; -import { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; -import { messageListData } from 'lib/selectors/chat-selectors.js'; +import { + type ChatMessageInfoItem, + messageListData, +} from 'lib/selectors/chat-selectors.js'; import { createMessageInfo, modifyItemForResultScreen, } from 'lib/shared/message-utils.js'; import { filterChatMessageInfosForSearch } from 'lib/shared/search-utils.js'; import type { RawMessageInfo } from 'lib/types/message-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useSelector } from '../../redux/redux-utils.js'; function useParseSearchResults( - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, searchResults: $ReadOnlyArray, ): $ReadOnlyArray { const userInfos = useSelector(state => state.userStore.userInfos); diff --git a/web/modals/threads/confirm-leave-thread-modal.react.js b/web/modals/threads/confirm-leave-thread-modal.react.js --- a/web/modals/threads/confirm-leave-thread-modal.react.js +++ b/web/modals/threads/confirm-leave-thread-modal.react.js @@ -2,7 +2,8 @@ import * as React from 'react'; -import { type ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 css from './confirm-leave-thread-modal.css'; @@ -10,7 +11,7 @@ import Modal from '../modal.react.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +onClose: () => void, +onConfirm: () => void, }; diff --git a/web/modals/threads/create/compose-subchannel-modal.react.js b/web/modals/threads/create/compose-subchannel-modal.react.js --- a/web/modals/threads/create/compose-subchannel-modal.react.js +++ b/web/modals/threads/create/compose-subchannel-modal.react.js @@ -3,12 +3,13 @@ import * as React from 'react'; import { - useNewThread, newThreadActionTypes, + useNewThread, } from 'lib/actions/thread-actions.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; @@ -16,8 +17,8 @@ import css from './compose-subchannel-modal.css'; import SubchannelMembers from './steps/subchannel-members.react.js'; -import SubchannelSettings from './steps/subchannel-settings.react.js'; import type { VisibilityType } from './steps/subchannel-settings.react.js'; +import SubchannelSettings from './steps/subchannel-settings.react.js'; import Stepper from '../../../components/stepper.react.js'; import { updateNavInfoActionType } from '../../../redux/action-types.js'; import { useSelector } from '../../../redux/redux-utils.js'; @@ -26,7 +27,7 @@ type Props = { +onClose: () => void, - +parentThreadInfo: ThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; const getThreadType = (visibility: VisibilityType, announcement: boolean) => { diff --git a/web/modals/threads/create/steps/subchannel-members-list.react.js b/web/modals/threads/create/steps/subchannel-members-list.react.js --- a/web/modals/threads/create/steps/subchannel-members-list.react.js +++ b/web/modals/threads/create/steps/subchannel-members-list.react.js @@ -4,7 +4,11 @@ import { useENSNames } from 'lib/hooks/ens-cache.js'; import { stringForUser } from 'lib/shared/user-utils.js'; -import type { RelativeMemberInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + RelativeMemberInfo, +} from 'lib/types/thread-types.js'; import type { UserListItem } from 'lib/types/user-types.js'; import { useSelector } from '../../../../redux/redux-utils.js'; @@ -13,8 +17,8 @@ type Props = { +searchText: string, +searchResult: $ReadOnlySet, - +communityThreadInfo: ThreadInfo, - +parentThreadInfo: ThreadInfo, + +communityThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +selectedUsers: $ReadOnlySet, +toggleUserSelection: (userID: string) => void, }; diff --git a/web/modals/threads/create/steps/subchannel-members.react.js b/web/modals/threads/create/steps/subchannel-members.react.js --- a/web/modals/threads/create/steps/subchannel-members.react.js +++ b/web/modals/threads/create/steps/subchannel-members.react.js @@ -4,14 +4,15 @@ import { useUserSearchIndex } from 'lib/selectors/nav-selectors.js'; import { useAncestorThreads } from 'lib/shared/ancestor-threads.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import MembersList from './subchannel-members-list.react.js'; import css from './subchannel-members.css'; import Search from '../../../../components/search.react.js'; type SubchannelMembersProps = { - +parentThreadInfo: ThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +selectedUsers: $ReadOnlySet, +searchText: string, +setSearchText: string => void, diff --git a/web/modals/threads/gallery/thread-settings-media-gallery.react.js b/web/modals/threads/gallery/thread-settings-media-gallery.react.js --- a/web/modals/threads/gallery/thread-settings-media-gallery.react.js +++ b/web/modals/threads/gallery/thread-settings-media-gallery.react.js @@ -10,7 +10,8 @@ encryptedVideoThumbnailBlobURI, } from 'lib/media/media-utils.js'; import type { Media } from 'lib/types/media-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import GalleryItem from './thread-settings-media-gallery-item.react.js'; import css from './thread-settings-media-gallery.css'; @@ -37,7 +38,7 @@ type ThreadSettingsMediaGalleryModalProps = { +onClose: () => void, - +parentThreadInfo: ThreadInfo, + +parentThreadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +limit: number, +activeTab: MediaGalleryTab, }; diff --git a/web/modals/threads/members/change-member-role-modal.react.js b/web/modals/threads/members/change-member-role-modal.react.js --- a/web/modals/threads/members/change-member-role-modal.react.js +++ b/web/modals/threads/members/change-member-role-modal.react.js @@ -4,14 +4,18 @@ import * as React from 'react'; import { - useChangeThreadMemberRoles, changeThreadMemberRolesActionTypes, + useChangeThreadMemberRoles, } from 'lib/actions/thread-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { otherUsersButNoOtherAdmins } from 'lib/selectors/thread-selectors.js'; import { roleIsAdminRole } from 'lib/shared/thread-utils.js'; -import type { RelativeMemberInfo, ThreadInfo } from 'lib/types/thread-types'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + RelativeMemberInfo, +} from 'lib/types/thread-types'; import { values } from 'lib/utils/objects.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; @@ -25,7 +29,7 @@ type ChangeMemberRoleModalProps = { +memberInfo: RelativeMemberInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ChangeMemberRoleModal(props: ChangeMemberRoleModalProps): React.Node { diff --git a/web/modals/threads/members/member.react.js b/web/modals/threads/members/member.react.js --- a/web/modals/threads/members/member.react.js +++ b/web/modals/threads/members/member.react.js @@ -6,12 +6,16 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { - removeMemberFromThread, getAvailableThreadMemberActions, + removeMemberFromThread, } from 'lib/shared/thread-utils.js'; import { stringForUser } from 'lib/shared/user-utils.js'; import type { SetState } from 'lib/types/hook-types.js'; -import type { RelativeMemberInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + RelativeMemberInfo, +} from 'lib/types/thread-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { useRolesFromCommunityThreadInfo } from 'lib/utils/role-utils.js'; @@ -28,7 +32,7 @@ type Props = { +memberInfo: RelativeMemberInfo, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +setOpenMenu: SetState, }; diff --git a/web/modals/threads/members/members-list.react.js b/web/modals/threads/members/members-list.react.js --- a/web/modals/threads/members/members-list.react.js +++ b/web/modals/threads/members/members-list.react.js @@ -7,16 +7,17 @@ import { useENSNames } from 'lib/hooks/ens-cache.js'; import { stringForUser } from 'lib/shared/user-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type RelativeMemberInfo, - type ThreadInfo, + type LegacyThreadInfo, } from 'lib/types/thread-types.js'; import ThreadMember from './member.react.js'; import css from './members-modal.css'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +threadMembers: $ReadOnlyArray, }; diff --git a/web/modals/threads/settings/thread-settings-delete-confirmation-modal.react.js b/web/modals/threads/settings/thread-settings-delete-confirmation-modal.react.js --- a/web/modals/threads/settings/thread-settings-delete-confirmation-modal.react.js +++ b/web/modals/threads/settings/thread-settings-delete-confirmation-modal.react.js @@ -4,14 +4,15 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import { getThreadsToDeleteText } from 'lib/shared/thread-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types'; import css from './thread-settings-delete-confirmation-modal.css'; import Button from '../../../components/button.react.js'; import Modal from '../../modal.react.js'; type BaseProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +onConfirmation: () => mixed, }; diff --git a/web/modals/threads/settings/thread-settings-delete-tab.react.js b/web/modals/threads/settings/thread-settings-delete-tab.react.js --- a/web/modals/threads/settings/thread-settings-delete-tab.react.js +++ b/web/modals/threads/settings/thread-settings-delete-tab.react.js @@ -10,7 +10,8 @@ import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { containedThreadInfos } from 'lib/selectors/thread-selectors.js'; import { type SetState } from 'lib/types/hook-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 SubmitSection from './submit-section.react.js'; @@ -21,7 +22,7 @@ type ThreadSettingsDeleteTabProps = { +threadSettingsOperationInProgress: boolean, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +setErrorMessage: SetState, +errorMessage?: ?string, }; diff --git a/web/modals/threads/settings/thread-settings-general-tab.react.js b/web/modals/threads/settings/thread-settings-general-tab.react.js --- a/web/modals/threads/settings/thread-settings-general-tab.react.js +++ b/web/modals/threads/settings/thread-settings-general-tab.react.js @@ -9,8 +9,12 @@ } from 'lib/actions/thread-actions.js'; import { threadHasPermission } from 'lib/shared/thread-utils.js'; import { type SetState } from 'lib/types/hook-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; -import { type ThreadChanges, type ThreadInfo } from 'lib/types/thread-types.js'; +import { + type ThreadChanges, + type LegacyThreadInfo, +} from 'lib/types/thread-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { firstLine } from 'lib/utils/string-utils.js'; import { chatNameMaxLength } from 'lib/utils/validation-utils.js'; @@ -24,7 +28,7 @@ type ThreadSettingsGeneralTabProps = { +threadSettingsOperationInProgress: boolean, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +threadNamePlaceholder: string, +queuedChanges: ThreadChanges, +setQueuedChanges: SetState, diff --git a/web/modals/threads/settings/thread-settings-modal.react.js b/web/modals/threads/settings/thread-settings-modal.react.js --- a/web/modals/threads/settings/thread-settings-modal.react.js +++ b/web/modals/threads/settings/thread-settings-modal.react.js @@ -4,22 +4,26 @@ import * as React from 'react'; import { - deleteThreadActionTypes, changeThreadSettingsActionTypes, + deleteThreadActionTypes, } from 'lib/actions/thread-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { getAvailableRelationshipButtons } from 'lib/shared/relationship-utils.js'; import { - threadHasPermission, getSingleOtherUser, + threadHasPermission, threadUIName, } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } 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 ThreadChanges, type ThreadInfo } from 'lib/types/thread-types.js'; +import { + type ThreadChanges, + type LegacyThreadInfo, +} from 'lib/types/thread-types.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import ThreadSettingsDeleteTab from './thread-settings-delete-tab.react.js'; @@ -50,9 +54,8 @@ deleteThreadLoadingStatusSelector(state) === 'loading' || changeThreadSettingsLoadingStatusSelector(state) === 'loading', ); - const threadInfo: ?ThreadInfo = useSelector( - state => threadInfoSelector(state)[props.threadID], - ); + const threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo = + useSelector(state => threadInfoSelector(state)[props.threadID]); const modalContext = useModalContext(); const [errorMessage, setErrorMessage] = React.useState(''); const [currentTabType, setCurrentTabType] = @@ -100,7 +103,7 @@ const hasPermissionForTab = React.useCallback( // ESLint doesn't recognize that invariant always throws // eslint-disable-next-line consistent-return - (thread: ThreadInfo, tab: TabType) => { + (thread: LegacyThreadInfo | MinimallyEncodedThreadInfo, tab: TabType) => { if (tab === 'general') { return ( threadHasPermission(thread, threadPermissions.EDIT_THREAD_NAME) || diff --git a/web/modals/threads/settings/thread-settings-privacy-tab.react.js b/web/modals/threads/settings/thread-settings-privacy-tab.react.js --- a/web/modals/threads/settings/thread-settings-privacy-tab.react.js +++ b/web/modals/threads/settings/thread-settings-privacy-tab.react.js @@ -3,15 +3,19 @@ import * as React from 'react'; import { - useChangeThreadSettings, changeThreadSettingsActionTypes, + useChangeThreadSettings, } from 'lib/actions/thread-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { threadTypeDescriptions } from 'lib/shared/thread-utils.js'; import { type SetState } from 'lib/types/hook-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import { type ThreadChanges, type ThreadInfo } from 'lib/types/thread-types.js'; +import { + type ThreadChanges, + type LegacyThreadInfo, +} from 'lib/types/thread-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import SubmitSection from './submit-section.react.js'; @@ -38,7 +42,7 @@ type ThreadSettingsPrivacyTabProps = { +threadSettingsOperationInProgress: boolean, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +queuedChanges: ThreadChanges, +setQueuedChanges: SetState, +setErrorMessage: SetState, diff --git a/web/modals/threads/thread-picker-modal.react.js b/web/modals/threads/thread-picker-modal.react.js --- a/web/modals/threads/thread-picker-modal.react.js +++ b/web/modals/threads/thread-picker-modal.react.js @@ -5,7 +5,8 @@ import { useGlobalThreadSearchIndex } from 'lib/selectors/nav-selectors.js'; import { onScreenEntryEditableThreadInfos } from 'lib/selectors/thread-selectors.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 css from './thread-picker-modal.css'; @@ -16,7 +17,7 @@ import Modal, { type ModalOverridableProps } from '../modal.react.js'; type OptionProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +createNewEntry: (threadID: string) => void, +onCloseModal: () => void, }; diff --git a/web/modals/user-profile/user-profile-action-buttons.react.js b/web/modals/user-profile/user-profile-action-buttons.react.js --- a/web/modals/user-profile/user-profile-action-buttons.react.js +++ b/web/modals/user-profile/user-profile-action-buttons.react.js @@ -4,8 +4,9 @@ import * as React from 'react'; import { useRelationshipPrompt } from 'lib/hooks/relationship-prompt.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from 'lib/types/relationship-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types'; +import type { LegacyThreadInfo } from 'lib/types/thread-types'; import UserProfileMessageButton from './user-profile-message-button.react.js'; import css from './user-profile.css'; @@ -13,7 +14,7 @@ import { buttonThemes } from '../../components/button.react.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function UserProfileActionButtons(props: Props): React.Node { diff --git a/web/modals/user-profile/user-profile-menu.react.js b/web/modals/user-profile/user-profile-menu.react.js --- a/web/modals/user-profile/user-profile-menu.react.js +++ b/web/modals/user-profile/user-profile-menu.react.js @@ -6,8 +6,9 @@ import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { useRelationshipPrompt } from 'lib/hooks/relationship-prompt.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from 'lib/types/relationship-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types'; +import type { LegacyThreadInfo } from 'lib/types/thread-types'; import MenuItem from '../../components/menu-item.react.js'; import Menu from '../../components/menu.react.js'; @@ -21,7 +22,7 @@ const unblockIcon = ; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function UserProfileMenu(props: Props): React.Node { diff --git a/web/modals/user-profile/user-profile-message-button.react.js b/web/modals/user-profile/user-profile-message-button.react.js --- a/web/modals/user-profile/user-profile-message-button.react.js +++ b/web/modals/user-profile/user-profile-message-button.react.js @@ -4,14 +4,15 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './user-profile.css'; import Button from '../../components/button.react.js'; import { useOnClickThread } from '../../selectors/thread-selectors.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function UserProfileMessageButton(props: Props): React.Node { diff --git a/web/navigation-panels/chat-thread-ancestors.react.js b/web/navigation-panels/chat-thread-ancestors.react.js --- a/web/navigation-panels/chat-thread-ancestors.react.js +++ b/web/navigation-panels/chat-thread-ancestors.react.js @@ -5,13 +5,14 @@ import { ChevronRight } from 'react-feather'; import { useAncestorThreads } from 'lib/shared/ancestor-threads.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 css from './chat-thread-ancestors.css'; type ThreadAncestorsProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ThreadAncestors(props: ThreadAncestorsProps): React.Node { const { threadInfo } = props; diff --git a/web/navigation-panels/nav-state-info-bar.react.js b/web/navigation-panels/nav-state-info-bar.react.js --- a/web/navigation-panels/nav-state-info-bar.react.js +++ b/web/navigation-panels/nav-state-info-bar.react.js @@ -3,14 +3,15 @@ import classnames from 'classnames'; import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import ThreadAncestors from './chat-thread-ancestors.react.js'; import css from './nav-state-info-bar.css'; import ThreadAvatar from '../avatars/thread-avatar.react.js'; type NavStateInfoBarProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function NavStateInfoBar(props: NavStateInfoBarProps): React.Node { const { threadInfo } = props; @@ -26,7 +27,7 @@ } type PossiblyEmptyNavStateInfoBarProps = { - +threadInfoInput: ?ThreadInfo, + +threadInfoInput: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, }; function PossiblyEmptyNavStateInfoBar( props: PossiblyEmptyNavStateInfoBarProps, diff --git a/web/roles/community-roles-modal.react.js b/web/roles/community-roles-modal.react.js --- a/web/roles/community-roles-modal.react.js +++ b/web/roles/community-roles-modal.react.js @@ -5,8 +5,9 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { useRoleMemberCountsForCommunity } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { UserSurfacedPermission } from 'lib/types/thread-permission-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './community-roles-modal.css'; import CreateRolesModal from './create-roles-modal.react.js'; @@ -16,18 +17,19 @@ import { useSelector } from '../redux/redux-utils.js'; type CommunityRolesModalProps = { - +community: ThreadInfo, + +community: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function CommunityRolesModal(props: CommunityRolesModalProps): React.Node { const { popModal, pushModal } = useModalContext(); const { community } = props; - const [threadInfo, setThreadInfo] = React.useState(community); + const [threadInfo, setThreadInfo] = React.useState< + LegacyThreadInfo | MinimallyEncodedThreadInfo, + >(community); const threadID = threadInfo.id; - const reduxThreadInfo: ?ThreadInfo = useSelector( - state => threadInfoSelector(state)[threadID], - ); + const reduxThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo = + useSelector(state => threadInfoSelector(state)[threadID]); React.useEffect(() => { if (reduxThreadInfo) { diff --git a/web/roles/create-roles-modal.react.js b/web/roles/create-roles-modal.react.js --- a/web/roles/create-roles-modal.react.js +++ b/web/roles/create-roles-modal.react.js @@ -5,20 +5,21 @@ import * as React from 'react'; import { - useModifyCommunityRole, modifyCommunityRoleActionTypes, + useModifyCommunityRole, } from 'lib/actions/thread-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type UserSurfacedPermission, type UserSurfacedPermissionOption, userSurfacedPermissionOptions, } from 'lib/types/thread-permission-types.js'; import type { + LegacyThreadInfo, RoleModificationRequest, - ThreadInfo, } from 'lib/types/thread-types.js'; import { values } from 'lib/utils/objects.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; @@ -37,7 +38,7 @@ ); type CreateRolesModalProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +action: 'create_role' | 'edit_role', +existingRoleID?: string, +roleName: string, diff --git a/web/roles/delete-role-modal.react.js b/web/roles/delete-role-modal.react.js --- a/web/roles/delete-role-modal.react.js +++ b/web/roles/delete-role-modal.react.js @@ -3,14 +3,15 @@ import * as React from 'react'; import { - useDeleteCommunityRole, deleteCommunityRoleActionTypes, + useDeleteCommunityRole, } from 'lib/actions/thread-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { useRoleMemberCountsForCommunity } from 'lib/shared/thread-utils.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } 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 { constructRoleDeletionMessagePrompt } from 'lib/utils/role-utils.js'; @@ -24,7 +25,7 @@ ); type DeleteRoleModalProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +defaultRoleID: string, +roleID: string, }; diff --git a/web/roles/role-actions-menu.react.js b/web/roles/role-actions-menu.react.js --- a/web/roles/role-actions-menu.react.js +++ b/web/roles/role-actions-menu.react.js @@ -6,7 +6,8 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { useRoleUserSurfacedPermissions } from 'lib/shared/thread-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useRoleDeletableAndEditableStatus } from 'lib/utils/role-utils.js'; import CreateRolesModal from './create-roles-modal.react.js'; @@ -18,7 +19,7 @@ const menuIcon = ; type RoleActionsMenuProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +roleName: string, }; diff --git a/web/roles/role-panel-entry.react.js b/web/roles/role-panel-entry.react.js --- a/web/roles/role-panel-entry.react.js +++ b/web/roles/role-panel-entry.react.js @@ -2,14 +2,15 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import RoleActionsMenu from './role-actions-menu.react.js'; import css from './role-panel-entry.css'; import CommIcon from '../CommIcon.react.js'; type RolePanelEntryProps = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, +roleName: string, +memberCount: number, }; diff --git a/web/selectors/calendar-selectors.js b/web/selectors/calendar-selectors.js --- a/web/selectors/calendar-selectors.js +++ b/web/selectors/calendar-selectors.js @@ -9,7 +9,8 @@ import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import type SearchIndex from 'lib/shared/search-index.js'; import type { FilterThreadInfo } from 'lib/types/filter-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { filterThreadIDsBelongingToCommunity } from 'lib/utils/drawer-utils.react.js'; import type { AppState } from '../redux/redux-setup.js'; @@ -32,7 +33,9 @@ threadInfoSelector, ( calendarPickedCommunityID: ?string, - threadInfos: { +[id: string]: ThreadInfo }, + threadInfos: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, ) => { if (!calendarPickedCommunityID) { return null; diff --git a/web/selectors/chat-selectors.js b/web/selectors/chat-selectors.js --- a/web/selectors/chat-selectors.js +++ b/web/selectors/chat-selectors.js @@ -4,17 +4,18 @@ import { createSelector } from 'reselect'; import { - messageInfoSelector, type ChatThreadItem, createChatThreadItem, + messageInfoSelector, } from 'lib/selectors/chat-selectors.js'; import { - threadInfoSelector, sidebarInfoSelector, + threadInfoSelector, } from 'lib/selectors/thread-selectors.js'; import { threadIsPending } from 'lib/shared/thread-utils.js'; -import type { MessageStore, MessageInfo } from 'lib/types/message-types.js'; -import type { SidebarInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MessageInfo, MessageStore } from 'lib/types/message-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo, SidebarInfo } from 'lib/types/thread-types.js'; import type { AppState } from '../redux/redux-setup.js'; import { useSelector } from '../redux/redux-utils.js'; @@ -28,11 +29,13 @@ (state: AppState) => state.navInfo.pendingThread, sidebarInfoSelector, ( - threadInfos: { +[id: string]: ThreadInfo }, + threadInfos: { + +[id: string]: LegacyThreadInfo | MinimallyEncodedThreadInfo, + }, messageStore: MessageStore, messageInfos: { +[id: string]: ?MessageInfo }, activeChatThreadID: ?string, - pendingThreadInfo: ?ThreadInfo, + pendingThreadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, sidebarInfos: { +[id: string]: $ReadOnlyArray }, ): ?ChatThreadItem => { if (!activeChatThreadID) { @@ -55,7 +58,9 @@ }, ); -function useChatThreadItem(threadInfo: ?ThreadInfo): ?ChatThreadItem { +function useChatThreadItem( + threadInfo: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, +): ?ChatThreadItem { const messageInfos = useSelector(messageInfoSelector); const sidebarInfos = useSelector(sidebarInfoSelector); const messageStore = useSelector(state => state.messageStore); diff --git a/web/selectors/thread-selectors.js b/web/selectors/thread-selectors.js --- a/web/selectors/thread-selectors.js +++ b/web/selectors/thread-selectors.js @@ -15,7 +15,11 @@ ComposableMessageInfo, RobotextMessageInfo, } from 'lib/types/message-types.js'; -import type { RawThreadInfos, ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + LegacyThreadInfo, + RawThreadInfos, +} from 'lib/types/thread-types.js'; import { values } from 'lib/utils/objects.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; @@ -25,7 +29,7 @@ import { useSelector } from '../redux/redux-utils.js'; function useOnClickThread( - thread: ?ThreadInfo, + thread: ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo, ): (event: SyntheticEvent) => void { const dispatch = useDispatch(); return React.useCallback( @@ -65,7 +69,7 @@ function useOnClickPendingSidebar( messageInfo: ComposableMessageInfo | RobotextMessageInfo, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): (event: SyntheticEvent) => mixed { const dispatch = useDispatch(); const loggedInUserInfo = useLoggedInUserInfo(); diff --git a/web/sidebar/community-drawer-item-community-handlers.react.js b/web/sidebar/community-drawer-item-community-handlers.react.js --- a/web/sidebar/community-drawer-item-community-handlers.react.js +++ b/web/sidebar/community-drawer-item-community-handlers.react.js @@ -3,11 +3,12 @@ import * as React from 'react'; import { + clearChatCommunityFilter, updateCalendarCommunityFilter, updateChatCommunityFilter, - clearChatCommunityFilter, } from 'lib/actions/community-actions.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import type { CommunityDrawerItemCommunityHandler } from './community-drawer-item-handler.react.js'; @@ -21,7 +22,7 @@ export type HandlerProps = { +setHandler: (handler: CommunityDrawerItemCommunityHandler) => void, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ChatDrawerItemCommunityHandler(props: HandlerProps): React.Node { diff --git a/web/sidebar/community-drawer-item-handlers.react.js b/web/sidebar/community-drawer-item-handlers.react.js --- a/web/sidebar/community-drawer-item-handlers.react.js +++ b/web/sidebar/community-drawer-item-handlers.react.js @@ -2,7 +2,8 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { CommunityDrawerItemHandler } from './community-drawer-item-handler.react.js'; import { useCommunityIsPickedCalendar } from '../selectors/calendar-selectors.js'; @@ -14,7 +15,7 @@ export type HandlerProps = { +setHandler: (handler: CommunityDrawerItemHandler) => void, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function ChatDrawerItemHandler(props: HandlerProps): React.Node { diff --git a/web/sidebar/community-drawer-utils.react.js b/web/sidebar/community-drawer-utils.react.js --- a/web/sidebar/community-drawer-utils.react.js +++ b/web/sidebar/community-drawer-utils.react.js @@ -2,7 +2,8 @@ import * as React from 'react'; -import type { ThreadInfo } from 'lib/types/thread-types'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types'; import type { CommunityDrawerItemData } from 'lib/utils/drawer-utils.react'; import css from './community-drawer-item.css'; @@ -27,7 +28,7 @@ hasSubchannelsButton: boolean, itemChildren: $ReadOnlyArray>, paddingLeft: number, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, expandable: boolean, handlerType: NavigationTab, }): React.Node { diff --git a/web/sidebar/subchannels-button.react.js b/web/sidebar/subchannels-button.react.js --- a/web/sidebar/subchannels-button.react.js +++ b/web/sidebar/subchannels-button.react.js @@ -4,14 +4,15 @@ import { CornerDownRight } from 'react-feather'; import { useModalContext } from 'lib/components/modal-provider.react.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './subchannels-button.css'; import Button from '../components/button.react.js'; import SubchannelsModal from '../modals/threads/subchannels/subchannels-modal.react.js'; type Props = { - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function SubchannelsButton(props: Props): React.Node { diff --git a/web/tooltips/message-tooltip.react.js b/web/tooltips/message-tooltip.react.js --- a/web/tooltips/message-tooltip.react.js +++ b/web/tooltips/message-tooltip.react.js @@ -7,7 +7,8 @@ import type { ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js'; import { useNextLocalID } from 'lib/shared/message-utils.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import css from './message-tooltip.css'; import { @@ -18,12 +19,12 @@ import { useTooltipContext } from './tooltip-provider.js'; import type { MessageTooltipAction, - TooltipSize, TooltipPositionStyle, + TooltipSize, } from './tooltip-utils.js'; import { - useSendReaction, getEmojiKeyboardPosition, + useSendReaction, } from '../chat/reaction-message-utils.js'; type MessageTooltipProps = { @@ -32,7 +33,7 @@ +tooltipPositionStyle: TooltipPositionStyle, +tooltipSize: TooltipSize, +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function MessageTooltip(props: MessageTooltipProps): React.Node { const { diff --git a/web/tooltips/tooltip-action-utils.js b/web/tooltips/tooltip-action-utils.js --- a/web/tooltips/tooltip-action-utils.js +++ b/web/tooltips/tooltip-action-utils.js @@ -6,8 +6,8 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import { useResettingState } from 'lib/hooks/use-resetting-state.js'; import type { - ReactionInfo, ChatMessageInfoItem, + ReactionInfo, } from 'lib/selectors/chat-selectors.js'; import { useCanEditMessage } from 'lib/shared/edit-messages-utils.js'; import { createMessageReply } from 'lib/shared/message-utils.js'; @@ -17,8 +17,9 @@ useSidebarExistsOrCanBeCreated, } from 'lib/shared/thread-utils.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import { longAbsoluteDate } from 'lib/utils/date-utils.js'; import { canToggleMessagePin } from 'lib/utils/message-pinning-utils.js'; @@ -27,11 +28,11 @@ import ReactionTooltip from './reaction-tooltip.react.js'; import { useTooltipContext } from './tooltip-provider.js'; import { - type MessageTooltipAction, - getTooltipPositionStyle, + calculateLabelTooltipSize, calculateMessageTooltipSize, calculateReactionTooltipSize, - calculateLabelTooltipSize, + getTooltipPositionStyle, + type MessageTooltipAction, type TooltipPosition, type TooltipPositionStyle, type TooltipSize, @@ -129,7 +130,7 @@ function useMessageTooltipSidebarAction( item: ChatMessageInfoItem, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): ?MessageTooltipAction { const { threadCreatedFromMessage, messageInfo } = item; const { popModal } = useModalContext(); @@ -171,7 +172,7 @@ function useMessageTooltipReplyAction( item: ChatMessageInfoItem, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): ?MessageTooltipAction { const { messageInfo } = item; const { popModal } = useModalContext(); @@ -236,7 +237,7 @@ function useMessageReactAction( item: ChatMessageInfoItem, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): ?MessageTooltipAction { const { messageInfo } = item; @@ -271,7 +272,7 @@ function useMessageTogglePinAction( item: ChatMessageInfoItem, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): ?MessageTooltipAction { const { pushModal } = useModalContext(); const { messageInfo, isPinned } = item; @@ -307,7 +308,7 @@ function useMessageEditAction( item: ChatMessageInfoItem, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): ?MessageTooltipAction { const { messageInfo } = item; @@ -350,7 +351,7 @@ function useMessageTooltipActions( item: ChatMessageInfoItem, - threadInfo: ThreadInfo, + threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, ): $ReadOnlyArray { const sidebarAction = useMessageTooltipSidebarAction(item, threadInfo); const replyAction = useMessageTooltipReplyAction(item, threadInfo); @@ -387,7 +388,7 @@ type UseMessageTooltipArgs = { +availablePositions: $ReadOnlyArray, +item: ChatMessageInfoItem, - +threadInfo: ThreadInfo, + +threadInfo: LegacyThreadInfo | MinimallyEncodedThreadInfo, }; function useMessageTooltip({ diff --git a/web/types/nav-types.js b/web/types/nav-types.js --- a/web/types/nav-types.js +++ b/web/types/nav-types.js @@ -1,12 +1,11 @@ // @flow -import t from 'tcomb'; import type { TInterface } from 'tcomb'; +import t from 'tcomb'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type BaseNavInfo } from 'lib/types/nav-types.js'; -import { - legacyThreadInfoValidator, - type ThreadInfo, -} from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; +import { legacyThreadInfoValidator } from 'lib/types/thread-types.js'; import { type AccountUserInfo, accountUserInfoValidator, @@ -35,7 +34,7 @@ ...$Exact, +tab: NavigationTab, +activeChatThreadID: ?string, - +pendingThread?: ThreadInfo, + +pendingThread?: LegacyThreadInfo | MinimallyEncodedThreadInfo, +settingsSection?: NavigationSettingsSection, +selectedUserList?: $ReadOnlyArray, +chatMode?: NavigationChatMode, diff --git a/web/utils/thread-utils.js b/web/utils/thread-utils.js --- a/web/utils/thread-utils.js +++ b/web/utils/thread-utils.js @@ -10,8 +10,9 @@ createPendingThread, useExistingThreadInfoFinder, } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import type { ThreadInfo } from 'lib/types/thread-types.js'; +import type { LegacyThreadInfo } from 'lib/types/thread-types.js'; import type { AccountUserInfo } from 'lib/types/user-types.js'; import { useSelector } from '../redux/redux-utils.js'; @@ -39,7 +40,7 @@ function useThreadInfoForPossiblyPendingThread( activeChatThreadID: ?string, -): ?ThreadInfo { +): ?LegacyThreadInfo | ?MinimallyEncodedThreadInfo { const { isChatCreation, selectedUserInfos } = useInfosForPendingThread(); const loggedInUserInfo = useLoggedInUserInfo();