diff --git a/keyserver/src/fetchers/thread-fetchers.js b/keyserver/src/fetchers/thread-fetchers.js --- a/keyserver/src/fetchers/thread-fetchers.js +++ b/keyserver/src/fetchers/thread-fetchers.js @@ -12,7 +12,7 @@ import { hasMinCodeVersion } from 'lib/shared/version-utils.js'; import type { AvatarDBContent, ClientAvatar } from 'lib/types/avatar-types.js'; import type { RawMessageInfo, MessageInfo } from 'lib/types/message-types.js'; -import type { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes, type ThreadType } from 'lib/types/thread-types-enum.js'; import { type ServerThreadInfo, @@ -284,7 +284,7 @@ ); const threadInfos: { - [string]: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + [string]: LegacyRawThreadInfo | RawThreadInfo, } = {}; for (const threadID in serverResult.threadInfos) { const serverThreadInfo = serverResult.threadInfos[threadID]; diff --git a/keyserver/src/shared/state-sync/threads-state-sync-spec.js b/keyserver/src/shared/state-sync/threads-state-sync-spec.js --- a/keyserver/src/shared/state-sync/threads-state-sync-spec.js +++ b/keyserver/src/shared/state-sync/threads-state-sync-spec.js @@ -2,7 +2,7 @@ import { rawThreadInfoValidator } from 'lib/permissions/minimally-encoded-thread-permissions-validators.js'; import { threadsStateSyncSpec as libSpec } from 'lib/shared/state-sync/threads-state-sync-spec.js'; -import type { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ClientThreadInconsistencyReportCreationRequest } from 'lib/types/report-types.js'; import { type RawThreadInfos, @@ -18,7 +18,7 @@ export const threadsStateSyncSpec: ServerStateSyncSpec< RawThreadInfos, RawThreadInfos, - LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + LegacyRawThreadInfo | RawThreadInfo, $ReadOnlyArray, > = Object.freeze({ fetch, @@ -45,8 +45,6 @@ return combineUnorderedHashes(values(infos).map(getServerInfoHash)); } -function getServerInfoHash( - info: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, -) { +function getServerInfoHash(info: LegacyRawThreadInfo | RawThreadInfo) { return hash(validateOutput(null, rawThreadInfoValidator, info)); } 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 @@ -14,7 +14,7 @@ import { childThreadInfos } from '../selectors/thread-selectors.js'; import { threadInChatList } from '../shared/thread-utils.js'; import threadWatcher from '../shared/thread-watcher.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { ThreadInfo } from '../types/thread-types.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -41,7 +41,7 @@ }, [childThreads, predicate]); const filterSubchannels = React.useCallback( - (thread: ?(MinimallyEncodedRawThreadInfo | ThreadInfo)) => { + (thread: ?(RawThreadInfo | ThreadInfo)) => { const candidateThreadID = thread?.id; if (!candidateThreadID) { return false; 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,7 +10,7 @@ import { sidebarInfoSelector } from '../selectors/thread-selectors.js'; import { threadIsChannel } from '../shared/thread-utils.js'; import type { SetState } from '../types/hook-types.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { SidebarInfo, ThreadInfo } from '../types/thread-types.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -100,7 +100,7 @@ threadInfo: ThreadInfo, ): SearchThreadsResult { const filterFunc = React.useCallback( - (thread: ?(ThreadInfo | MinimallyEncodedRawThreadInfo)) => + (thread: ?(ThreadInfo | RawThreadInfo)) => threadIsChannel(thread) && thread?.parentThreadID === threadInfo.id, [threadInfo.id], ); diff --git a/lib/ops/thread-store-ops.js b/lib/ops/thread-store-ops.js --- a/lib/ops/thread-store-ops.js +++ b/lib/ops/thread-store-ops.js @@ -1,7 +1,7 @@ // @flow import { type BaseStoreOpsHandlers } from './base-ops.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { ClientDBThreadInfo, MinimallyEncodedRawThreadInfos, @@ -23,7 +23,7 @@ export type ReplaceThreadOperation = { +type: 'replace', - +payload: { +id: string, +threadInfo: MinimallyEncodedRawThreadInfo }, + +payload: { +id: string, +threadInfo: RawThreadInfo }, }; export type ThreadStoreOperation = @@ -87,7 +87,7 @@ }, translateClientDBData(data: $ReadOnlyArray): { - +[id: string]: MinimallyEncodedRawThreadInfo, + +[id: string]: RawThreadInfo, } { return Object.fromEntries( data.map((dbThreadInfo: ClientDBThreadInfo) => [ diff --git a/lib/permissions/minimally-encoded-thread-permissions-test-data.js b/lib/permissions/minimally-encoded-thread-permissions-test-data.js --- a/lib/permissions/minimally-encoded-thread-permissions-test-data.js +++ b/lib/permissions/minimally-encoded-thread-permissions-test-data.js @@ -1,6 +1,6 @@ // @flow -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import type { LegacyRawThreadInfo } from '../types/thread-types.js'; @@ -306,7 +306,7 @@ pinnedCount: 0, }; -const exampleMinimallyEncodedRawThreadInfoA: MinimallyEncodedRawThreadInfo = { +const exampleMinimallyEncodedRawThreadInfoA: RawThreadInfo = { minimallyEncoded: true, id: '85171', type: threadTypes.PERSONAL, diff --git a/lib/permissions/minimally-encoded-thread-permissions-validators.js b/lib/permissions/minimally-encoded-thread-permissions-validators.js --- a/lib/permissions/minimally-encoded-thread-permissions-validators.js +++ b/lib/permissions/minimally-encoded-thread-permissions-validators.js @@ -8,7 +8,7 @@ } from './minimally-encoded-thread-permissions.js'; import type { MinimallyEncodedMemberInfo, - MinimallyEncodedRawThreadInfo, + RawThreadInfo, MinimallyEncodedRelativeMemberInfo, MinimallyEncodedResolvedThreadInfo, MinimallyEncodedRoleInfo, @@ -68,8 +68,8 @@ uiName: t.String, }); -const minimallyEncodedRawThreadInfoValidator: TInterface = - tShape({ +const minimallyEncodedRawThreadInfoValidator: TInterface = + tShape({ ...legacyRawThreadInfoValidator.meta.props, minimallyEncoded: tBool(true), members: t.list(minimallyEncodedMemberInfoValidator), @@ -78,7 +78,7 @@ }); export const rawThreadInfoValidator: TUnion< - LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + LegacyRawThreadInfo | RawThreadInfo, > = t.union([ legacyRawThreadInfoValidator, minimallyEncodedRawThreadInfoValidator, diff --git a/lib/reducers/integrity-reducer.js b/lib/reducers/integrity-reducer.js --- a/lib/reducers/integrity-reducer.js +++ b/lib/reducers/integrity-reducer.js @@ -10,7 +10,7 @@ } from '../actions/user-actions.js'; import type { ThreadStoreOperation } from '../ops/thread-store-ops'; import type { IntegrityStore } from '../types/integrity-types'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAction } from '../types/redux-types.js'; import { fullStateSyncActionType } from '../types/socket-types.js'; import { hash } from '../utils/objects.js'; @@ -19,7 +19,7 @@ state: IntegrityStore, action: BaseAction, threadInfos: { - +[string]: MinimallyEncodedRawThreadInfo, + +[string]: RawThreadInfo, }, threadStoreOperations: $ReadOnlyArray, ): IntegrityStore { diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js --- a/lib/reducers/message-reducer.js +++ b/lib/reducers/message-reducer.js @@ -88,7 +88,7 @@ } from '../types/message-types.js'; import type { RawImagesMessageInfo } from '../types/messages/images.js'; import type { RawMediaMessageInfo } from '../types/messages/media.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { type BaseAction } from '../types/redux-types.js'; import { processServerRequestsActionType } from '../types/request-types.js'; import { @@ -127,7 +127,7 @@ function isThreadWatched( threadID: string, - threadInfo: ?LegacyRawThreadInfo | ?MinimallyEncodedRawThreadInfo, + threadInfo: ?LegacyRawThreadInfo | ?RawThreadInfo, watchedIDs: $ReadOnlyArray, ) { return ( diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js --- a/lib/reducers/thread-reducer.js +++ b/lib/reducers/thread-reducer.js @@ -32,7 +32,7 @@ } from '../ops/thread-store-ops.js'; import { stateSyncSpecs } from '../shared/state-sync/state-sync-specs.js'; import { updateSpecs } from '../shared/updates/update-specs.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAction } from '../types/redux-types.js'; import { type ClientThreadInconsistencyReportCreationRequest } from '../types/report-types.js'; import { @@ -203,7 +203,7 @@ threadIDToMostRecentTime.set(messageInfo.threadID, messageInfo.time); } } - const changedThreadInfos: { [string]: MinimallyEncodedRawThreadInfo } = {}; + const changedThreadInfos: { [string]: RawThreadInfo } = {}; for (const [threadID, mostRecentTime] of threadIDToMostRecentTime) { const threadInfo = state.threadInfos[threadID]; if ( @@ -298,7 +298,7 @@ threadStoreOperations, }; } else if (action.type === updateActivityActionTypes.success) { - const updatedThreadInfos: { [string]: MinimallyEncodedRawThreadInfo } = {}; + const updatedThreadInfos: { [string]: RawThreadInfo } = {}; for (const setToUnread of action.payload.result.unfocusedToUnread) { const threadInfo = state.threadInfos[setToUnread]; if (threadInfo && !threadInfo.currentUser.unread) { 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 @@ -35,7 +35,7 @@ type LocalMessageInfo, isComposableMessageType, } from '../types/message-types.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { 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 { @@ -227,9 +227,7 @@ } function useFilteredChatListData( - filterFunction: ( - threadInfo: ?(ThreadInfo | MinimallyEncodedRawThreadInfo), - ) => boolean, + filterFunction: (threadInfo: ?(ThreadInfo | RawThreadInfo)) => boolean, ): $ReadOnlyArray { const threadInfos = useSelector(threadInfoSelector); const messageInfos = useSelector(messageInfoSelector); @@ -254,9 +252,7 @@ messageStore: MessageStore, messageInfos: { +[id: string]: ?MessageInfo }, sidebarInfos: { +[id: string]: $ReadOnlyArray }, - filterFunction: ( - threadInfo: ?(ThreadInfo | MinimallyEncodedRawThreadInfo), - ) => boolean, + filterFunction: (threadInfo: ?(ThreadInfo | RawThreadInfo)) => boolean, ): $ReadOnlyArray { return _flow( _filter(filterFunction), 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,7 +12,7 @@ defaultCalendarQuery, } from '../types/entry-types.js'; import type { CalendarFilter } from '../types/filter-types.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { 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'; @@ -117,7 +117,7 @@ } function useThreadSearchIndex( - threadInfos: $ReadOnlyArray, + threadInfos: $ReadOnlyArray, ): SearchIndex { const userInfos = useSelector(state => state.userStore.userInfos); const viewerID = useSelector( diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -39,7 +39,7 @@ import type { ClientAvatar, ClientEmojiAvatar } from '../types/avatar-types'; import type { EntryInfo } from '../types/entry-types.js'; import type { MessageStore, RawMessageInfo } from '../types/message-types.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAppState } from '../types/redux-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; import { @@ -344,7 +344,7 @@ (state: BaseAppState<>) => state.threadStore.threadInfos[threadID], relativeMemberInfoSelectorForMembersOfThread(threadID), ( - threadInfo: ?MinimallyEncodedRawThreadInfo, + threadInfo: ?RawThreadInfo, members: $ReadOnlyArray, ): boolean => { if (!threadInfo) { diff --git a/lib/selectors/user-selectors.js b/lib/selectors/user-selectors.js --- a/lib/selectors/user-selectors.js +++ b/lib/selectors/user-selectors.js @@ -9,7 +9,7 @@ } from '../shared/avatar-utils.js'; import { getSingleOtherUser } from '../shared/thread-utils.js'; import type { ClientEmojiAvatar } from '../types/avatar-types'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAppState } from '../types/redux-types.js'; import { userRelationshipStatus } from '../types/relationship-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; @@ -54,9 +54,7 @@ type ExtractArrayParam = (arr: $ReadOnlyArray) => T; -function getRelativeMemberInfos< - TI: MinimallyEncodedRawThreadInfo | LegacyRawThreadInfo, ->( +function getRelativeMemberInfos( threadInfo: ?TI, currentUserID: ?string, userInfos: UserInfos, 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 @@ -16,7 +16,7 @@ ResolvedClientAvatar, GenericUserInfoWithAvatar, } from '../types/avatar-types.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { 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 { UserInfos } from '../types/user-types.js'; @@ -271,7 +271,7 @@ } function getUserAvatarForThread( - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, viewerID: ?string, userInfos: UserInfos, ): ClientAvatar { @@ -297,7 +297,7 @@ } function getAvatarForThread( - thread: MinimallyEncodedRawThreadInfo | ThreadInfo, + thread: RawThreadInfo | ThreadInfo, containingThreadInfo: ?ThreadInfo, ): ClientAvatar { if (thread.avatar) { @@ -313,9 +313,7 @@ return getDefaultAvatar(thread.id, thread.color); } -function useAvatarForThread( - thread: MinimallyEncodedRawThreadInfo | ThreadInfo, -): ClientAvatar { +function useAvatarForThread(thread: RawThreadInfo | ThreadInfo): ClientAvatar { const containingThreadID = thread.containingThreadID; const containingThreadInfo = useSelector(state => containingThreadID ? threadInfoSelector(state)[containingThreadID] : null, 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 @@ -42,7 +42,7 @@ RawReactionMessageInfo, ReactionMessageInfo, } from '../types/messages/reaction.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { LegacyRawThreadInfo, ThreadInfo } from '../types/thread-types.js'; import type { UserInfos } from '../types/user-types.js'; import { @@ -681,7 +681,7 @@ function isInvalidPinSourceForThread( messageInfo: RawMessageInfo | MessageInfo, - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, ): boolean { const isValidPinSource = !isInvalidPinSource(messageInfo); const isFirstMessageInSidebar = threadInfo.sourceMessageID === messageInfo.id; diff --git a/lib/shared/state-sync/threads-state-sync-spec.js b/lib/shared/state-sync/threads-state-sync-spec.js --- a/lib/shared/state-sync/threads-state-sync-spec.js +++ b/lib/shared/state-sync/threads-state-sync-spec.js @@ -4,7 +4,7 @@ import { createSelector } from 'reselect'; import type { StateSyncSpec, BoundStateSyncSpec } from './state-sync-spec.js'; -import type { MinimallyEncodedRawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js'; import type { AppState } from '../../types/redux-types.js'; import { reportTypes, @@ -26,7 +26,7 @@ state: AppState, ) => BoundStateSyncSpec< RawThreadInfos, - LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + LegacyRawThreadInfo | RawThreadInfo, $ReadOnlyArray, > = createSelector( (state: AppState) => state.integrityStore.threadHashes, @@ -45,7 +45,7 @@ export const threadsStateSyncSpec: StateSyncSpec< RawThreadInfos, - LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + LegacyRawThreadInfo | RawThreadInfo, $ReadOnlyArray, > = Object.freeze({ hashKey: 'threadInfos', diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -58,7 +58,7 @@ type ComposableMessageInfo, } from '../types/message-types.js'; import type { - MinimallyEncodedRawThreadInfo, + RawThreadInfo, MinimallyEncodedThreadCurrentUserInfo, MinimallyEncodedThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; @@ -127,11 +127,7 @@ import { pendingThreadIDRegex } from '../utils/validation-utils.js'; function threadHasPermission( - threadInfo: ?( - | ThreadInfo - | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo - ), + threadInfo: ?(ThreadInfo | LegacyRawThreadInfo | RawThreadInfo), permission: ThreadPermission, ): boolean { if (!threadInfo) { @@ -149,11 +145,7 @@ } function viewerIsMember( - threadInfo: ?( - | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo - | ThreadInfo - ), + threadInfo: ?(LegacyRawThreadInfo | RawThreadInfo | ThreadInfo), ): boolean { return !!( threadInfo && @@ -162,19 +154,13 @@ ); } -function threadIsInHome( - threadInfo: ?(MinimallyEncodedRawThreadInfo | ThreadInfo), -): boolean { +function threadIsInHome(threadInfo: ?(RawThreadInfo | ThreadInfo)): boolean { return !!(threadInfo && threadInfo.currentUser.subscription.home); } // Can have messages function threadInChatList( - threadInfo: ?( - | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo - | ThreadInfo - ), + threadInfo: ?(LegacyRawThreadInfo | RawThreadInfo | ThreadInfo), ): boolean { return ( viewerIsMember(threadInfo) && @@ -182,32 +168,26 @@ ); } -function threadIsTopLevel( - threadInfo: ?(MinimallyEncodedRawThreadInfo | ThreadInfo), -): boolean { +function threadIsTopLevel(threadInfo: ?(RawThreadInfo | ThreadInfo)): boolean { return threadInChatList(threadInfo) && threadIsChannel(threadInfo); } -function threadIsChannel( - threadInfo: ?(MinimallyEncodedRawThreadInfo | ThreadInfo), -): boolean { +function threadIsChannel(threadInfo: ?(RawThreadInfo | ThreadInfo)): boolean { return !!(threadInfo && threadInfo.type !== threadTypes.SIDEBAR); } -function threadIsSidebar( - threadInfo: ?(MinimallyEncodedRawThreadInfo | ThreadInfo), -): boolean { +function threadIsSidebar(threadInfo: ?(RawThreadInfo | ThreadInfo)): boolean { return threadInfo?.type === threadTypes.SIDEBAR; } function threadInBackgroundChatList( - threadInfo: ?(MinimallyEncodedRawThreadInfo | ThreadInfo), + threadInfo: ?(RawThreadInfo | ThreadInfo), ): boolean { return threadInChatList(threadInfo) && !threadIsInHome(threadInfo); } function threadInHomeChatList( - threadInfo: ?(MinimallyEncodedRawThreadInfo | ThreadInfo), + threadInfo: ?(RawThreadInfo | ThreadInfo), ): boolean { return threadInChatList(threadInfo) && threadIsInHome(threadInfo); } @@ -215,11 +195,7 @@ // Can have Calendar entries, // does appear as a top-level entity in the thread list function threadInFilterList( - threadInfo: ?( - | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo - | ThreadInfo - ), + threadInfo: ?(LegacyRawThreadInfo | RawThreadInfo | ThreadInfo), ): boolean { return ( threadInChatList(threadInfo) && @@ -229,11 +205,7 @@ } function userIsMember( - threadInfo: ?( - | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo - | ThreadInfo - ), + threadInfo: ?(LegacyRawThreadInfo | RawThreadInfo | ThreadInfo), userID: string, ): boolean { if (!threadInfo) { @@ -263,7 +235,7 @@ } function threadMembersWithoutAddedAshoat< - T: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + T: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, >(threadInfo: T): $PropertyType { if (threadInfo.community !== genesis.id) { return threadInfo.members; @@ -278,7 +250,7 @@ } function threadOrParentThreadIsGroupChat( - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, ) { return threadMembersWithoutAddedAshoat(threadInfo).length > 2; } @@ -292,7 +264,7 @@ } function getSingleOtherUser( - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, viewerID: ?string, ): ?string { if (!viewerID) { @@ -773,7 +745,7 @@ serverThreadInfo: ServerThreadInfo, viewerID: string, options?: RawThreadInfoOptions, -): ?LegacyRawThreadInfo | ?MinimallyEncodedRawThreadInfo { +): ?LegacyRawThreadInfo | ?RawThreadInfo { const filterThreadEditAvatarPermission = options?.filterThreadEditAvatarPermission; const excludePinInfo = options?.excludePinInfo; @@ -926,7 +898,7 @@ } function threadInfoFromRawThreadInfo( - rawThreadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + rawThreadInfo: LegacyRawThreadInfo | RawThreadInfo, viewerID: ?string, userInfos: UserInfos, ): MinimallyEncodedThreadInfo { @@ -1019,7 +991,7 @@ } function getMinimallyEncodedCurrentUser( - threadInfo: MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, + threadInfo: RawThreadInfo | MinimallyEncodedThreadInfo, viewerID: ?string, userInfos: UserInfos, ): MinimallyEncodedThreadCurrentUserInfo { @@ -1041,7 +1013,7 @@ } function threadIsWithBlockedUserOnly( - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, viewerID: ?string, userInfos: UserInfos, checkOnlyViewerBlock?: boolean, @@ -1073,7 +1045,7 @@ } function threadFrozenDueToBlock( - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, viewerID: ?string, userInfos: UserInfos, ): boolean { @@ -1081,7 +1053,7 @@ } function threadFrozenDueToViewerBlock( - threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: RawThreadInfo | ThreadInfo, viewerID: ?string, userInfos: UserInfos, ): boolean { @@ -1097,7 +1069,7 @@ function memberIsAdmin( memberInfo: RelativeMemberInfo | MemberInfo, - threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: RawThreadInfo | ThreadInfo, ): boolean { return !!( memberInfo.role && roleIsAdminRole(threadInfo.roles[memberInfo.role]) @@ -1122,7 +1094,7 @@ function threadHasAdminRole( threadInfo: ?( | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo + | RawThreadInfo | ThreadInfo | ServerThreadInfo ), @@ -1134,7 +1106,7 @@ } function threadOrParentThreadHasAdminRole( - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, ) { return ( threadMembersWithoutAddedAshoat(threadInfo).filter(member => @@ -1385,7 +1357,7 @@ threadInfo: | ServerThreadInfo | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo + | RawThreadInfo | ThreadInfo, memberID: string, permission: ThreadPermission, @@ -1468,7 +1440,7 @@ parentThreadInfo: | ?ServerThreadInfo | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo + | RawThreadInfo | ThreadInfo, threadType: ThreadType, ): ?string { @@ -1488,7 +1460,7 @@ parentThreadInfo: | ?ServerThreadInfo | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo + | RawThreadInfo | ThreadInfo, ): ?string { if (!parentThreadInfo) { @@ -1681,7 +1653,7 @@ } function threadInfoInsideCommunity( - threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: RawThreadInfo | ThreadInfo, communityID: string, ): boolean { return threadInfo.community === communityID || threadInfo.id === communityID; @@ -1763,16 +1735,14 @@ }, [threadInfo]); } -function communityOrThreadNoun( - threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, -): string { +function communityOrThreadNoun(threadInfo: RawThreadInfo | ThreadInfo): string { return threadTypeIsCommunityRoot(threadInfo.type) ? 'community' : threadNoun(threadInfo.type, threadInfo.parentThreadID); } function getThreadsToDeleteText( - threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: RawThreadInfo | ThreadInfo, ): string { return `${ threadTypeIsCommunityRoot(threadInfo.type) 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,7 +2,7 @@ import { memberHasAdminPowers } from './thread-utils.js'; import { useENSNames } from '../hooks/ens-cache.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { ServerThreadInfo, ThreadInfo } from '../types/thread-types.js'; import type { UserInfo } from '../types/user-types.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -30,7 +30,7 @@ } function useKeyserverAdmin( - community: ThreadInfo | MinimallyEncodedRawThreadInfo | ServerThreadInfo, + community: ThreadInfo | 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/minimally-encoded-thread-permissions-types.js b/lib/types/minimally-encoded-thread-permissions-types.js --- a/lib/types/minimally-encoded-thread-permissions-types.js +++ b/lib/types/minimally-encoded-thread-permissions-types.js @@ -146,7 +146,7 @@ }; }; -export type MinimallyEncodedRawThreadInfo = $ReadOnly<{ +export type RawThreadInfo = $ReadOnly<{ ...LegacyRawThreadInfo, +minimallyEncoded: true, +members: $ReadOnlyArray, @@ -156,7 +156,7 @@ const minimallyEncodeRawThreadInfo = ( rawThreadInfo: LegacyRawThreadInfo, -): MinimallyEncodedRawThreadInfo => { +): RawThreadInfo => { invariant( !('minimallyEncoded' in rawThreadInfo), 'rawThreadInfo is already minimally encoded.', @@ -172,7 +172,7 @@ }; const decodeMinimallyEncodedRawThreadInfo = ( - minimallyEncodedRawThreadInfo: MinimallyEncodedRawThreadInfo, + minimallyEncodedRawThreadInfo: RawThreadInfo, ): LegacyRawThreadInfo => { const { minimallyEncoded, members, roles, currentUser, ...rest } = minimallyEncodedRawThreadInfo; diff --git a/lib/types/request-types.js b/lib/types/request-types.js --- a/lib/types/request-types.js +++ b/lib/types/request-types.js @@ -12,7 +12,7 @@ type CalendarQuery, rawEntryInfoValidator, } from './entry-types.js'; -import type { MinimallyEncodedRawThreadInfo } from './minimally-encoded-thread-permissions-types'; +import type { RawThreadInfo } from './minimally-encoded-thread-permissions-types'; import type { ThreadInconsistencyReportShape, EntryInconsistencyReportShape, @@ -104,7 +104,7 @@ }>; type StateChanges = Partial<{ - +rawThreadInfos: LegacyRawThreadInfo[] | MinimallyEncodedRawThreadInfo[], + +rawThreadInfos: LegacyRawThreadInfo[] | RawThreadInfo[], +rawEntryInfos: RawEntryInfo[], +currentUserInfo: CurrentUserInfo, +userInfos: AccountUserInfo[], @@ -229,7 +229,7 @@ +userInfos: boolean, }>, +stateChanges?: Partial<{ - +rawThreadInfos: MinimallyEncodedRawThreadInfo[], + +rawThreadInfos: RawThreadInfo[], +rawEntryInfos: RawEntryInfo[], +currentUserInfo: CurrentUserInfo, +userInfos: AccountUserInfo[], diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -16,7 +16,7 @@ } from './message-types.js'; import type { MinimallyEncodedMemberInfo, - MinimallyEncodedRawThreadInfo, + RawThreadInfo, MinimallyEncodedRelativeMemberInfo, MinimallyEncodedResolvedThreadInfo, MinimallyEncodedRoleInfo, @@ -145,10 +145,10 @@ }); export type RawThreadInfos = { - +[id: string]: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + +[id: string]: LegacyRawThreadInfo | RawThreadInfo, }; export type MinimallyEncodedRawThreadInfos = { - +[id: string]: MinimallyEncodedRawThreadInfo, + +[id: string]: RawThreadInfo, }; export type LegacyThreadInfo = { @@ -450,14 +450,14 @@ export type RoleModificationRequest = CreateRoleAction | EditRoleAction; export type RoleModificationResult = { - +threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + +threadInfo: LegacyRawThreadInfo | RawThreadInfo, +updatesResult: { +newUpdates: $ReadOnlyArray, }, }; export type RoleModificationPayload = { - +threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + +threadInfo: LegacyRawThreadInfo | RawThreadInfo, +updatesResult: { +newUpdates: $ReadOnlyArray, }, @@ -469,14 +469,14 @@ }; export type RoleDeletionResult = { - +threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + +threadInfo: LegacyRawThreadInfo | RawThreadInfo, +updatesResult: { +newUpdates: $ReadOnlyArray, }, }; export type RoleDeletionPayload = { - +threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + +threadInfo: LegacyRawThreadInfo | RawThreadInfo, +updatesResult: { +newUpdates: $ReadOnlyArray, }, diff --git a/lib/types/update-types.js b/lib/types/update-types.js --- a/lib/types/update-types.js +++ b/lib/types/update-types.js @@ -7,7 +7,7 @@ type RawMessageInfo, type MessageTruncationStatus, } from './message-types.js'; -import type { MinimallyEncodedRawThreadInfo } from './minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from './minimally-encoded-thread-permissions-types.js'; import type { LegacyRawThreadInfo } from './thread-types.js'; import { type UserInfo, @@ -184,7 +184,7 @@ +type: 1, +id: string, +time: number, - +threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + +threadInfo: LegacyRawThreadInfo | RawThreadInfo, }; export type ThreadReadStatusUpdateInfo = { @@ -206,7 +206,7 @@ +type: 4, +id: string, +time: number, - +threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + +threadInfo: LegacyRawThreadInfo | RawThreadInfo, +rawMessageInfos: $ReadOnlyArray, +truncationStatus: MessageTruncationStatus, +rawEntryInfos: $ReadOnlyArray, 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,7 +4,7 @@ import { values } from './objects.js'; import { threadInFilterList, threadIsChannel } from '../shared/thread-utils.js'; -import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { 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'; @@ -101,7 +101,7 @@ function filterThreadIDsBelongingToCommunity( communityID: string, threadInfosObj: { - +[id: string]: MinimallyEncodedRawThreadInfo | ThreadInfo, + +[id: string]: RawThreadInfo | ThreadInfo, }, ): $ReadOnlySet { const threadInfos = values(threadInfosObj); 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,7 +9,7 @@ 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 { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { type ThreadType, threadTypes, @@ -139,19 +139,13 @@ } | { +display?: 'shortName', - +threadInfo: - | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo - | ThreadInfo, + +threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, +subchannel?: ?boolean, +possessive?: ?boolean, } | { +display: 'alwaysDisplayShortName', - +threadInfo: - | LegacyRawThreadInfo - | MinimallyEncodedRawThreadInfo - | ThreadInfo, + +threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, +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 @@ -3,13 +3,13 @@ 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 { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { 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'; function canToggleMessagePin( messageInfo: RawMessageInfo | MessageInfo, - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, ): boolean { const isValidMessage = !isInvalidPinSourceForThread(messageInfo, threadInfo); const hasManagePinsPermission = threadHasPermission( diff --git a/lib/utils/thread-ops-utils.js b/lib/utils/thread-ops-utils.js --- a/lib/utils/thread-ops-utils.js +++ b/lib/utils/thread-ops-utils.js @@ -9,7 +9,7 @@ } from '../permissions/minimally-encoded-thread-permissions-validators.js'; import type { MinimallyEncodedMemberInfo, - MinimallyEncodedRawThreadInfo, + RawThreadInfo, MinimallyEncodedRoleInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; import { @@ -28,7 +28,7 @@ } from '../types/thread-types.js'; function convertRawThreadInfoToClientDBThreadInfo( - rawThreadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + rawThreadInfo: LegacyRawThreadInfo | RawThreadInfo, ): ClientDBThreadInfo { const { minimallyEncoded, ...rest } = rawThreadInfo; return { @@ -43,7 +43,7 @@ function convertClientDBThreadInfoToRawThreadInfo( clientDBThreadInfo: ClientDBThreadInfo, -): MinimallyEncodedRawThreadInfo { +): RawThreadInfo { // 1. Validate and potentially minimally encode `rawMembers`. const rawMembers = JSON.parse(clientDBThreadInfo.members); const minimallyEncodedMembers: $ReadOnlyArray = @@ -88,7 +88,7 @@ ? rawCurrentUser : minimallyEncodeThreadCurrentUserInfo(rawCurrentUser); - let rawThreadInfo: MinimallyEncodedRawThreadInfo = { + let rawThreadInfo: RawThreadInfo = { minimallyEncoded: true, id: clientDBThreadInfo.id, type: assertThreadType(clientDBThreadInfo.type), 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,7 +6,7 @@ import { ActivityIndicator, TouchableOpacity, View } from 'react-native'; import { EditThreadAvatarContext } from 'lib/components/base-edit-thread-avatar-provider.react.js'; -import type { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; import { @@ -23,7 +23,7 @@ import { useStyles } from '../themes/colors.js'; type Props = { - +threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | ThreadInfo, +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,7 +8,7 @@ } 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 { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { 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'; @@ -16,7 +16,7 @@ import { useSelector } from '../redux/redux-utils.js'; type Props = { - +threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo | ResolvedThreadInfo, + +threadInfo: RawThreadInfo | ThreadInfo | ResolvedThreadInfo, +size: AvatarSize, }; 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,7 +6,7 @@ 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 { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; import { useNativeSetThreadAvatar } from '../../avatars/avatar-hooks.js'; @@ -17,7 +17,7 @@ import { useSelector } from '../../redux/redux-utils.js'; export type EmojiThreadAvatarCreationParams = { - +threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | ThreadInfo, }; type Props = { diff --git a/native/redux/client-db-utils.js b/native/redux/client-db-utils.js --- a/native/redux/client-db-utils.js +++ b/native/redux/client-db-utils.js @@ -7,7 +7,7 @@ ClientDBMessageInfo, ClientDBThreadMessageInfo, } from 'lib/types/message-types.js'; -import type { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ClientDBThreadInfo, LegacyRawThreadInfo, @@ -73,8 +73,8 @@ // Convert `rawThreadInfo`s to a map of `threadID` => `threadInfo`. const threadIDToThreadInfo = rawThreadInfos.reduce( ( - acc: { [string]: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo }, - threadInfo: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + acc: { [string]: LegacyRawThreadInfo | RawThreadInfo }, + threadInfo: LegacyRawThreadInfo | RawThreadInfo, ) => { acc[threadInfo.id] = threadInfo; return acc; @@ -87,7 +87,7 @@ // Convert the updated `threadInfo`s back into an array. const updatedRawThreadInfos: $ReadOnlyArray< - LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + LegacyRawThreadInfo | RawThreadInfo, > = values(updatedThreadIDToThreadInfo); // Translate `RawThreadInfo`s to `ClientDBThreadInfo`s. diff --git a/native/redux/persist.js b/native/redux/persist.js --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -63,7 +63,7 @@ type RawMessageInfo, } from 'lib/types/message-types.js'; import { minimallyEncodeRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ReportStore, ClientReportCreationRequest, @@ -384,7 +384,7 @@ } const threadInfos: { - [string]: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + [string]: LegacyRawThreadInfo | RawThreadInfo, } = {}; const stack = [...rootIDs]; while (stack.length > 0) { @@ -999,7 +999,7 @@ Object.keys(threadStoreInfos).reduce( ( acc: { - [string]: LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + [string]: LegacyRawThreadInfo | RawThreadInfo, }, key: string, ) => { 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,7 +6,7 @@ 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 { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; import { useUploadAvatarMedia } from './avatar-hooks.react.js'; @@ -23,7 +23,7 @@ ); type Props = { - +threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | ThreadInfo, }; 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,7 +5,7 @@ import { EditThreadAvatarContext } from 'lib/components/base-edit-thread-avatar-provider.react.js'; import { threadHasPermission } from 'lib/shared/thread-utils.js'; -import type { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { 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'; @@ -14,7 +14,7 @@ import ThreadAvatar from './thread-avatar.react.js'; type Props = { - +threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | ThreadInfo, +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,7 +8,7 @@ } 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 { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { 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'; @@ -16,7 +16,7 @@ import { useSelector } from '../redux/redux-utils.js'; type Props = { - +threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | ThreadInfo, +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,13 @@ ClientAvatar, ClientEmojiAvatar, } from 'lib/types/avatar-types.js'; -import type { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; import EmojiAvatarSelectionModal from './emoji-avatar-selection-modal.react.js'; type Props = { - +threadInfo: MinimallyEncodedRawThreadInfo | ThreadInfo, + +threadInfo: RawThreadInfo | ThreadInfo, }; function ThreadEmojiAvatarSelectionModal(props: Props): React.Node { diff --git a/web/redux/initial-state-gate.js b/web/redux/initial-state-gate.js --- a/web/redux/initial-state-gate.js +++ b/web/redux/initial-state-gate.js @@ -8,7 +8,7 @@ import type { ThreadStoreOperation } from 'lib/ops/thread-store-ops.js'; import { allUpdatesCurrentAsOfSelector } from 'lib/selectors/keyserver-selectors.js'; import { canUseDatabaseOnWeb } from 'lib/shared/web-database.js'; -import type { MinimallyEncodedRawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { LegacyRawThreadInfo } from 'lib/types/thread-types.js'; import { convertIDToNewSchema } from 'lib/utils/migration-utils.js'; import { entries } from 'lib/utils/objects.js'; @@ -101,7 +101,7 @@ ).map( ([id, threadInfo]: [ string, - LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo, + LegacyRawThreadInfo | RawThreadInfo, ]) => ({ type: 'replace', payload: {