From 819fb9e3c9f595e1094e11270259f9f6b07e9681 Mon Sep 17 00:00:00 2001 From: Atul Madhugiri Date: Tue, 28 Nov 2023 15:11:10 -0500 Subject: [PATCH] [lib] `RawThreadInfo` -> `LegacyRawThreadInfo` Summary: Same as D10066 and D10071 and D10073, but for `RawThreadInfo`. --- Depends on D10074 Test Plan: `flow`/CI/etc Reviewers: ashoat, ginsu, tomek, rohan Reviewed By: ashoat Differential Revision: https://phab.comm.dev/D10077 --- keyserver/src/creators/update-creator.js | 4 +- keyserver/src/fetchers/thread-fetchers.js | 8 +-- keyserver/src/responders/thread-responders.js | 6 +- keyserver/src/responders/user-responders.js | 6 +- .../generate-converter-from-validator.js | 4 +- .../state-sync/threads-state-sync-spec.js | 18 +++--- keyserver/src/socket/socket.js | 4 +- lib/actions/user-actions.js | 4 +- lib/hooks/child-threads.js | 4 +- lib/hooks/search-threads.js | 4 +- lib/ops/thread-store-ops.js | 10 ++-- ...ly-encoded-thread-permissions-test-data.js | 6 +- ...y-encoded-thread-permissions-validators.js | 4 +- lib/reducers/calendar-filters-reducer.js | 7 ++- lib/reducers/entry-reducer.js | 6 +- lib/reducers/integrity-reducer.js | 4 +- lib/reducers/message-reducer.js | 19 +++--- lib/reducers/thread-reducer.js | 10 ++-- lib/selectors/chat-selectors.js | 6 +- lib/selectors/nav-selectors.js | 4 +- lib/selectors/thread-selectors.js | 20 +++---- lib/selectors/user-selectors.js | 8 +-- lib/shared/avatar-utils.js | 11 ++-- lib/shared/message-utils.js | 4 +- .../state-sync/threads-state-sync-spec.js | 16 ++--- lib/shared/thread-utils.js | 60 +++++++++---------- lib/shared/updates/delete-account-spec.js | 4 +- lib/shared/updates/delete-thread-spec.js | 4 +- lib/shared/updates/join-thread-spec.js | 8 +-- lib/shared/updates/update-spec.js | 6 +- .../updates/update-thread-read-status-spec.js | 9 +-- lib/shared/updates/update-thread-spec.js | 8 +-- lib/shared/user-utils.js | 4 +- lib/types/account-types.js | 10 ++-- ...imally-encoded-thread-permissions-types.js | 8 +-- lib/types/report-types.js | 12 ++-- lib/types/request-types.js | 11 ++-- lib/types/session-types.js | 6 +- lib/types/socket-types.js | 9 ++- lib/types/thread-types.js | 24 ++++---- lib/types/update-types.js | 6 +- lib/types/validation.test.js | 6 +- lib/utils/drawer-utils.react.js | 4 +- lib/utils/entity-text.js | 9 ++- lib/utils/thread-ops-utils.js | 8 +-- lib/utils/thread-ops-utils.test.js | 6 +- lib/utils/toggle-pin-utils.js | 4 +- native/avatars/edit-thread-avatar.react.js | 7 ++- native/avatars/thread-avatar.react.js | 4 +- .../emoji-thread-avatar-creation.react.js | 7 ++- native/redux/client-db-utils.js | 9 ++- .../redux/edit-thread-permission-migration.js | 14 ++--- .../redux/manage-pins-permission-migration.js | 12 ++-- native/redux/persist.js | 16 +++-- .../redux/remove-select-role-permissions.js | 10 ++-- .../remove-select-role-permissions.test.js | 4 +- native/redux/update-roles-and-permissions.js | 11 ++-- native/selectors/message-selectors.js | 4 +- web/avatars/edit-thread-avatar-menu.react.js | 7 ++- web/avatars/edit-thread-avatar.react.js | 7 ++- web/avatars/thread-avatar.react.js | 7 ++- ...read-emoji-avatar-selection-modal.react.js | 7 ++- web/redux/initial-state-gate.js | 4 +- web/redux/nav-reducer.js | 4 +- web/selectors/thread-selectors.js | 7 ++- 65 files changed, 308 insertions(+), 256 deletions(-) diff --git a/keyserver/src/creators/update-creator.js b/keyserver/src/creators/update-creator.js index 49f1e25ff9..68267e238b 100644 --- a/keyserver/src/creators/update-creator.js +++ b/keyserver/src/creators/update-creator.js @@ -31,7 +31,7 @@ import { redisMessageTypes, type NewUpdatesRedisMessage, } from 'lib/types/redis-types.js'; -import type { RawThreadInfos } from 'lib/types/thread-types'; +import type { LegacyRawThreadInfos } from 'lib/types/thread-types'; import { type ServerUpdateInfo, type UpdateData, @@ -92,7 +92,7 @@ export type ViewerInfo = viewer: Viewer, calendarQuery: ?CalendarQuery, updatesForCurrentSession?: UpdatesForCurrentSession, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, }; const defaultUpdateCreationResult = { viewerUpdates: [], userInfos: {} }; const sortFunction = ( diff --git a/keyserver/src/fetchers/thread-fetchers.js b/keyserver/src/fetchers/thread-fetchers.js index e5097b264a..b7c8a52ce1 100644 --- a/keyserver/src/fetchers/thread-fetchers.js +++ b/keyserver/src/fetchers/thread-fetchers.js @@ -14,9 +14,9 @@ import type { AvatarDBContent, ClientAvatar } from 'lib/types/avatar-types.js'; import type { RawMessageInfo, MessageInfo } from 'lib/types/message-types.js'; import { threadTypes, type ThreadType } from 'lib/types/thread-types-enum.js'; import { - type RawThreadInfos, + type LegacyRawThreadInfos, type ServerThreadInfo, - type RawThreadInfo, + type LegacyRawThreadInfo, } from 'lib/types/thread-types.js'; import { ServerError } from 'lib/utils/errors.js'; @@ -245,7 +245,7 @@ async function fetchServerThreadInfos( } export type FetchThreadInfosResult = { - +threadInfos: RawThreadInfos, + +threadInfos: LegacyRawThreadInfos, }; async function fetchThreadInfos( @@ -278,7 +278,7 @@ function rawThreadInfosFromServerThreadInfos( native: 285, }); - const threadInfos: { [string]: RawThreadInfo } = {}; + const threadInfos: { [string]: LegacyRawThreadInfo } = {}; for (const threadID in serverResult.threadInfos) { const serverThreadInfo = serverResult.threadInfos[threadID]; const threadInfo = rawThreadInfoFromServerThreadInfo( diff --git a/keyserver/src/responders/thread-responders.js b/keyserver/src/responders/thread-responders.js index 8986d21075..87b7a6e08a 100644 --- a/keyserver/src/responders/thread-responders.js +++ b/keyserver/src/responders/thread-responders.js @@ -30,7 +30,7 @@ import { type RoleModificationResult, type RoleDeletionRequest, type RoleDeletionResult, - rawThreadInfoValidator, + legacyRawThreadInfoValidator, } from 'lib/types/thread-types.js'; import { serverUpdateInfoValidator } from 'lib/types/update-types.js'; import { userInfosValidator } from 'lib/types/user-types.js'; @@ -289,7 +289,7 @@ export const roleModificationRequestInputValidator: TUnion = tShape({ - threadInfo: t.maybe(rawThreadInfoValidator), + threadInfo: t.maybe(legacyRawThreadInfoValidator), updatesResult: tShape({ newUpdates: t.list(serverUpdateInfoValidator), }), @@ -310,7 +310,7 @@ export const roleDeletionRequestInputValidator: TInterface export const roleDeletionResultValidator: TInterface = tShape({ - threadInfo: t.maybe(rawThreadInfoValidator), + threadInfo: t.maybe(legacyRawThreadInfoValidator), updatesResult: tShape({ newUpdates: t.list(serverUpdateInfoValidator), }), diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js index 5b52394398..9a04c0f8fc 100644 --- a/keyserver/src/responders/user-responders.js +++ b/keyserver/src/responders/user-responders.js @@ -61,7 +61,7 @@ import { type SubscriptionUpdateResponse, threadSubscriptionValidator, } from 'lib/types/subscription-types.js'; -import { rawThreadInfoValidator } from 'lib/types/thread-types.js'; +import { legacyRawThreadInfoValidator } from 'lib/types/thread-types.js'; import { createUpdatesResultValidator } from 'lib/types/update-types.js'; import { type PasswordUpdate, @@ -253,7 +253,7 @@ export const registerResponseValidator: TInterface = rawMessageInfos: t.list(rawMessageInfoValidator), currentUserInfo: loggedInUserInfoValidator, cookieChange: tShape({ - threadInfos: t.dict(tID, rawThreadInfoValidator), + threadInfos: t.dict(tID, legacyRawThreadInfoValidator), userInfos: t.list(userInfoValidator), }), }); @@ -437,7 +437,7 @@ export const logInResponseValidator: TInterface = rawEntryInfos: t.maybe(t.list(rawEntryInfoValidator)), serverTime: t.Number, cookieChange: tShape({ - threadInfos: t.dict(tID, rawThreadInfoValidator), + threadInfos: t.dict(tID, legacyRawThreadInfoValidator), userInfos: t.list(userInfoValidator), }), notAcknowledgedPolicies: t.maybe(t.list(policyTypeValidator)), diff --git a/keyserver/src/scripts/generate-converter-from-validator.js b/keyserver/src/scripts/generate-converter-from-validator.js index 5f833b0b7c..8a6588ef99 100644 --- a/keyserver/src/scripts/generate-converter-from-validator.js +++ b/keyserver/src/scripts/generate-converter-from-validator.js @@ -7,7 +7,7 @@ import { mediaValidator, } from 'lib/types/media-types.js'; import { threadPermissionInfoValidator } from 'lib/types/thread-permission-types.js'; -import { rawThreadInfoValidator } from 'lib/types/thread-types.js'; +import { legacyRawThreadInfoValidator } from 'lib/types/thread-types.js'; import { ashoatKeyserverID, tID } from 'lib/utils/validation-utils.js'; import { main } from './utils.js'; @@ -213,7 +213,7 @@ function generateConverterFromValidator( } // Input arguments: -const validator = rawThreadInfoValidator; +const validator = legacyRawThreadInfoValidator; const typeName = 'RawThreadInfo'; const validatorToBeConverted = tID; const conversionExpressionString = (inputName: string) => diff --git a/keyserver/src/shared/state-sync/threads-state-sync-spec.js b/keyserver/src/shared/state-sync/threads-state-sync-spec.js index 16605ae29f..07821b9093 100644 --- a/keyserver/src/shared/state-sync/threads-state-sync-spec.js +++ b/keyserver/src/shared/state-sync/threads-state-sync-spec.js @@ -3,9 +3,9 @@ import { threadsStateSyncSpec as libSpec } from 'lib/shared/state-sync/threads-state-sync-spec.js'; import type { ClientThreadInconsistencyReportCreationRequest } from 'lib/types/report-types.js'; import { - type RawThreadInfos, - type RawThreadInfo, - rawThreadInfoValidator, + type LegacyRawThreadInfos, + type LegacyRawThreadInfo, + legacyRawThreadInfoValidator, } from 'lib/types/thread-types.js'; import { hash, combineUnorderedHashes, values } from 'lib/utils/objects.js'; @@ -15,9 +15,9 @@ import type { Viewer } from '../../session/viewer.js'; import { validateOutput } from '../../utils/validation-utils.js'; export const threadsStateSyncSpec: ServerStateSyncSpec< - RawThreadInfos, - RawThreadInfos, - RawThreadInfo, + LegacyRawThreadInfos, + LegacyRawThreadInfos, + LegacyRawThreadInfo, $ReadOnlyArray, > = Object.freeze({ fetch, @@ -40,10 +40,10 @@ async function fetch(viewer: Viewer, ids?: $ReadOnlySet) { return result.threadInfos; } -function getServerInfosHash(infos: RawThreadInfos) { +function getServerInfosHash(infos: LegacyRawThreadInfos) { return combineUnorderedHashes(values(infos).map(getServerInfoHash)); } -function getServerInfoHash(info: RawThreadInfo) { - return hash(validateOutput(null, rawThreadInfoValidator, info)); +function getServerInfoHash(info: LegacyRawThreadInfo) { + return hash(validateOutput(null, legacyRawThreadInfoValidator, info)); } diff --git a/keyserver/src/socket/socket.js b/keyserver/src/socket/socket.js index 40a814e37c..c6e413533d 100644 --- a/keyserver/src/socket/socket.js +++ b/keyserver/src/socket/socket.js @@ -41,7 +41,7 @@ import { serverSocketMessageTypes, serverServerSocketMessageValidator, } from 'lib/types/socket-types.js'; -import type { RawThreadInfos } from 'lib/types/thread-types.js'; +import type { LegacyRawThreadInfos } from 'lib/types/thread-types.js'; import type { UserInfo, CurrentUserInfo } from 'lib/types/user-types.js'; import { ServerError } from 'lib/utils/errors.js'; import { values } from 'lib/utils/objects.js'; @@ -515,7 +515,7 @@ class Socket { ); // We have a type error here because Flow doesn't know spec.hashKey const castPromises: { - +threadInfos: Promise, + +threadInfos: Promise, +currentUserInfo: Promise, +entryInfos: Promise<$ReadOnlyArray>, +userInfos: Promise<$ReadOnlyArray>, diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js index 2e1da94791..379f6ab323 100644 --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -38,7 +38,7 @@ import type { SubscriptionUpdateRequest, SubscriptionUpdateResult, } from '../types/subscription-types.js'; -import type { RawThreadInfos } from '../types/thread-types'; +import type { LegacyRawThreadInfos } from '../types/thread-types'; import type { UserInfo, PasswordUpdate, @@ -264,7 +264,7 @@ const logIn = const userInfosArrays = []; - let threadInfos: RawThreadInfos = {}; + let threadInfos: LegacyRawThreadInfos = {}; const calendarResult: WritableCalendarResult = { calendarQuery: logInInfo.calendarQuery, rawEntryInfos: [], diff --git a/lib/hooks/child-threads.js b/lib/hooks/child-threads.js index fb79be0ce6..e10a6b7886 100644 --- a/lib/hooks/child-threads.js +++ b/lib/hooks/child-threads.js @@ -18,7 +18,7 @@ import type { MinimallyEncodedThreadInfo, MinimallyEncodedRawThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; -import type { ThreadInfo, RawThreadInfo } from '../types/thread-types.js'; +import type { ThreadInfo, LegacyRawThreadInfo } from '../types/thread-types.js'; import { useDispatchActionPromise } from '../utils/action-utils.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -47,7 +47,7 @@ function useFilteredChildThreads( ( thread: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo ), diff --git a/lib/hooks/search-threads.js b/lib/hooks/search-threads.js index 5eb975f0d1..ca3badf82c 100644 --- a/lib/hooks/search-threads.js +++ b/lib/hooks/search-threads.js @@ -17,7 +17,7 @@ import type { import type { SidebarInfo, ThreadInfo, - RawThreadInfo, + LegacyRawThreadInfo, } from '../types/thread-types.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -110,7 +110,7 @@ function useSearchSubchannels( ( thread: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo ), diff --git a/lib/ops/thread-store-ops.js b/lib/ops/thread-store-ops.js index 26dbbc383b..62d8f97758 100644 --- a/lib/ops/thread-store-ops.js +++ b/lib/ops/thread-store-ops.js @@ -3,8 +3,8 @@ import { type BaseStoreOpsHandlers } from './base-ops.js'; import type { ClientDBThreadInfo, - RawThreadInfo, - RawThreadInfos, + LegacyRawThreadInfo, + LegacyRawThreadInfos, ThreadStore, } from '../types/thread-types.js'; import { @@ -23,7 +23,7 @@ export type RemoveAllThreadsOperation = { export type ReplaceThreadOperation = { +type: 'replace', - +payload: { +id: string, +threadInfo: RawThreadInfo }, + +payload: { +id: string, +threadInfo: LegacyRawThreadInfo }, }; export type ThreadStoreOperation = @@ -45,7 +45,7 @@ export const threadStoreOpsHandlers: BaseStoreOpsHandlers< ThreadStore, ThreadStoreOperation, ClientDBThreadStoreOperation, - RawThreadInfos, + LegacyRawThreadInfos, ClientDBThreadInfo, > = { processStoreOperations( @@ -87,7 +87,7 @@ export const threadStoreOpsHandlers: BaseStoreOpsHandlers< }, translateClientDBData(data: $ReadOnlyArray): { - +[id: string]: RawThreadInfo, + +[id: string]: LegacyRawThreadInfo, } { 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 index dbb88df4b2..a854b4e8c6 100644 --- a/lib/permissions/minimally-encoded-thread-permissions-test-data.js +++ b/lib/permissions/minimally-encoded-thread-permissions-test-data.js @@ -2,9 +2,9 @@ import type { MinimallyEncodedRawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; -import type { RawThreadInfo } from '../types/thread-types.js'; +import type { LegacyRawThreadInfo } from '../types/thread-types.js'; -const exampleRawThreadInfoA: RawThreadInfo = { +const exampleRawThreadInfoA: LegacyRawThreadInfo = { id: '85171', type: threadTypes.PERSONAL, name: '', @@ -370,7 +370,7 @@ const exampleMinimallyEncodedRawThreadInfoA: MinimallyEncodedRawThreadInfo = { pinnedCount: 0, }; -const expectedDecodedExampleRawThreadInfoA: RawThreadInfo = { +const expectedDecodedExampleRawThreadInfoA: LegacyRawThreadInfo = { id: '85171', type: threadTypes.PERSONAL, name: '', diff --git a/lib/permissions/minimally-encoded-thread-permissions-validators.js b/lib/permissions/minimally-encoded-thread-permissions-validators.js index f655b20e30..678eab77da 100644 --- a/lib/permissions/minimally-encoded-thread-permissions-validators.js +++ b/lib/permissions/minimally-encoded-thread-permissions-validators.js @@ -16,7 +16,7 @@ import type { } from '../types/minimally-encoded-thread-permissions-types.js'; import { legacyMemberInfoValidator, - rawThreadInfoValidator, + legacyRawThreadInfoValidator, legacyRoleInfoValidator, threadCurrentUserInfoValidator, threadInfoValidator, @@ -68,7 +68,7 @@ const minimallyEncodedResolvedThreadInfoValidator: TInterface = tShape({ - ...rawThreadInfoValidator.meta.props, + ...legacyRawThreadInfoValidator.meta.props, minimallyEncoded: tBool(true), members: t.list(minimallyEncodedMemberInfoValidator), roles: t.dict(tID, minimallyEncodedRoleInfoValidator), diff --git a/lib/reducers/calendar-filters-reducer.js b/lib/reducers/calendar-filters-reducer.js index f04b25d697..f1beb3fde3 100644 --- a/lib/reducers/calendar-filters-reducer.js +++ b/lib/reducers/calendar-filters-reducer.js @@ -37,7 +37,10 @@ import { fullStateSyncActionType, incrementalStateSyncActionType, } from '../types/socket-types.js'; -import type { RawThreadInfos, ThreadStore } from '../types/thread-types.js'; +import type { + LegacyRawThreadInfos, + ThreadStore, +} from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -158,7 +161,7 @@ function updateFilterListFromUpdateInfos( function removeDeletedThreadIDsFromFilterList( state: $ReadOnlyArray, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, ): $ReadOnlyArray { const currentlyFilteredIDs = filteredThreadIDs(state); if (!currentlyFilteredIDs) { diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js index 3e601d8243..17cf28ad33 100644 --- a/lib/reducers/entry-reducer.js +++ b/lib/reducers/entry-reducer.js @@ -54,7 +54,7 @@ import { fullStateSyncActionType, incrementalStateSyncActionType, } from '../types/socket-types.js'; -import { type RawThreadInfos } from '../types/thread-types.js'; +import { type LegacyRawThreadInfos } from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -90,7 +90,7 @@ function mergeNewEntryInfos( currentEntryInfos: { +[id: string]: RawEntryInfo }, currentDaysToEntries: ?{ +[day: string]: string[] }, newEntryInfos: $ReadOnlyArray, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, ) { const mergedEntryInfos: { [string]: RawEntryInfo } = {}; let someEntryUpdated = false; @@ -163,7 +163,7 @@ function mergeNewEntryInfos( function reduceEntryInfos( entryStore: EntryStore, action: BaseAction, - newThreadInfos: RawThreadInfos, + newThreadInfos: LegacyRawThreadInfos, ): [EntryStore, $ReadOnlyArray] { const { entryInfos, daysToEntries, lastUserInteractionCalendar } = entryStore; if ( diff --git a/lib/reducers/integrity-reducer.js b/lib/reducers/integrity-reducer.js index 42a47fe635..31ce68c895 100644 --- a/lib/reducers/integrity-reducer.js +++ b/lib/reducers/integrity-reducer.js @@ -11,13 +11,13 @@ import type { ThreadStoreOperation } from '../ops/thread-store-ops'; import type { IntegrityStore } from '../types/integrity-types'; import type { BaseAction } from '../types/redux-types.js'; import { fullStateSyncActionType } from '../types/socket-types.js'; -import type { RawThreadInfo } from '../types/thread-types.js'; +import type { LegacyRawThreadInfo } from '../types/thread-types.js'; import { hash } from '../utils/objects.js'; function reduceIntegrityStore( state: IntegrityStore, action: BaseAction, - threadInfos: { +[string]: RawThreadInfo }, + threadInfos: { +[string]: LegacyRawThreadInfo }, threadStoreOperations: $ReadOnlyArray, ): IntegrityStore { if ( diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js index 24e2385cba..c9c4b605f6 100644 --- a/lib/reducers/message-reducer.js +++ b/lib/reducers/message-reducer.js @@ -94,7 +94,10 @@ import { incrementalStateSyncActionType, } from '../types/socket-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; -import type { RawThreadInfo, RawThreadInfos } from '../types/thread-types.js'; +import type { + LegacyRawThreadInfo, + LegacyRawThreadInfos, +} from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -122,7 +125,7 @@ function mapThreadsToMessageIDsFromOrderedMessageInfos( function isThreadWatched( threadID: string, - threadInfo: ?RawThreadInfo, + threadInfo: ?LegacyRawThreadInfo, watchedIDs: $ReadOnlyArray, ) { return ( @@ -146,7 +149,7 @@ function freshMessageStore( messageInfos: $ReadOnlyArray, truncationStatus: { [threadID: string]: MessageTruncationStatus }, currentAsOf: { +[keyserverID: string]: number }, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, ): FreshMessageStoreResult { const unshimmed = unshimMessageInfos(messageInfos); const orderedMessageInfos = sortMessageInfoList(unshimmed); @@ -212,7 +215,7 @@ type ReassignmentResult = { function reassignMessagesToRealizedThreads( messageStore: MessageStore, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, ): ReassignmentResult { const pendingToRealizedThreadIDs = pendingToRealizedThreadIDsSelector(threadInfos); @@ -305,7 +308,7 @@ function mergeNewMessages( oldMessageStore: MessageStore, newMessageInfos: $ReadOnlyArray, truncationStatus: { +[threadID: string]: MessageTruncationStatus }, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, ): MergeNewMessagesResult { const { messageStoreOperations: updateWithLatestThreadInfosOps, @@ -629,7 +632,7 @@ type UpdateMessageStoreWithLatestThreadInfosResult = { }; function updateMessageStoreWithLatestThreadInfos( messageStore: MessageStore, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, ): UpdateMessageStoreWithLatestThreadInfosResult { const messageStoreOperations: MessageStoreOperation[] = []; const { @@ -697,7 +700,7 @@ function updateMessageStoreWithLatestThreadInfos( function ensureRealizedThreadIDIsUsedWhenPossible( payload: T, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, ): T { const pendingToRealizedThreadIDs = pendingToRealizedThreadIDsSelector(threadInfos); @@ -717,7 +720,7 @@ type ReduceMessageStoreResult = { function reduceMessageStore( messageStore: MessageStore, action: BaseAction, - newThreadInfos: RawThreadInfos, + newThreadInfos: LegacyRawThreadInfos, ): ReduceMessageStoreResult { if ( action.type === logInActionTypes.success || diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js index 9028b77f41..ce3bdad85b 100644 --- a/lib/reducers/thread-reducer.js +++ b/lib/reducers/thread-reducer.js @@ -42,8 +42,8 @@ import { incrementalStateSyncActionType, } from '../types/socket-types.js'; import type { - RawThreadInfo, - RawThreadInfos, + LegacyRawThreadInfo, + LegacyRawThreadInfos, ThreadStore, } from '../types/thread-types.js'; import { @@ -56,7 +56,7 @@ const { processStoreOperations: processThreadStoreOperations } = threadStoreOpsHandlers; function generateOpsForThreadUpdates( - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, payload: { +updatesResult: { +newUpdates: $ReadOnlyArray, ... }, ... @@ -202,7 +202,7 @@ function reduceThreadInfos( threadIDToMostRecentTime.set(messageInfo.threadID, messageInfo.time); } } - const changedThreadInfos: { [string]: RawThreadInfo } = {}; + const changedThreadInfos: { [string]: LegacyRawThreadInfo } = {}; for (const [threadID, mostRecentTime] of threadIDToMostRecentTime) { const threadInfo = state.threadInfos[threadID]; if ( @@ -297,7 +297,7 @@ function reduceThreadInfos( threadStoreOperations, }; } else if (action.type === updateActivityActionTypes.success) { - const updatedThreadInfos: { [string]: RawThreadInfo } = {}; + const updatedThreadInfos: { [string]: LegacyRawThreadInfo } = {}; 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 index 80f66e69a4..a84e090ac8 100644 --- a/lib/selectors/chat-selectors.js +++ b/lib/selectors/chat-selectors.js @@ -43,7 +43,7 @@ import type { BaseAppState } from '../types/redux-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import { type ThreadInfo, - type RawThreadInfo, + type LegacyRawThreadInfo, type SidebarInfo, maxReadSidebars, maxUnreadSidebars, @@ -234,7 +234,7 @@ function useFilteredChatListData( filterFunction: ( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo ), @@ -266,7 +266,7 @@ function getChatThreadItems( filterFunction: ( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo ), diff --git a/lib/selectors/nav-selectors.js b/lib/selectors/nav-selectors.js index f758de652d..7faede4ae4 100644 --- a/lib/selectors/nav-selectors.js +++ b/lib/selectors/nav-selectors.js @@ -18,7 +18,7 @@ import type { } 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 { RawThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { LegacyRawThreadInfo, ThreadInfo } from '../types/thread-types.js'; import type { UserInfo } from '../types/user-types.js'; import { getConfig } from '../utils/config.js'; import { values } from '../utils/objects.js'; @@ -84,7 +84,7 @@ const useENSNamesOptions = { allAtOnce: true }; function useThreadSearchIndex( threadInfos: $ReadOnlyArray< - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js index 79531e0bdf..84e8d86584 100644 --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -49,9 +49,9 @@ import { } from '../types/thread-types-enum.js'; import { type ThreadInfo, - type RawThreadInfo, + type LegacyRawThreadInfo, type SidebarInfo, - type RawThreadInfos, + type LegacyRawThreadInfos, type RelativeMemberInfo, } from '../types/thread-types.js'; import { dateString, dateFromString } from '../utils/date-utils.js'; @@ -275,7 +275,7 @@ const sidebarInfoSelector: (state: BaseAppState<>) => { const unreadCount: (state: BaseAppState<>) => number = createSelector( (state: BaseAppState<>) => state.threadStore.threadInfos, - (threadInfos: RawThreadInfos): number => + (threadInfos: LegacyRawThreadInfos): number => values(threadInfos).filter( threadInfo => threadInHomeChatList(threadInfo) && threadInfo.currentUser.unread, @@ -284,7 +284,7 @@ const unreadCount: (state: BaseAppState<>) => number = createSelector( const unreadBackgroundCount: (state: BaseAppState<>) => number = createSelector( (state: BaseAppState<>) => state.threadStore.threadInfos, - (threadInfos: RawThreadInfos): number => + (threadInfos: LegacyRawThreadInfos): number => values(threadInfos).filter( threadInfo => threadInBackgroundChatList(threadInfo) && threadInfo.currentUser.unread, @@ -323,7 +323,7 @@ const baseOtherUsersButNoOtherAdmins: ( (state: BaseAppState<>) => state.threadStore.threadInfos[threadID], relativeMemberInfoSelectorForMembersOfThread(threadID), ( - threadInfo: ?RawThreadInfo, + threadInfo: ?LegacyRawThreadInfo, members: $ReadOnlyArray, ): boolean => { if (!threadInfo) { @@ -357,7 +357,7 @@ const otherUsersButNoOtherAdmins: ( function mostRecentlyReadThread( messageStore: MessageStore, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, ): ?string { let mostRecent = null; for (const threadID in threadInfos) { @@ -399,7 +399,7 @@ const threadInfoFromSourceMessageIDSelector: (state: BaseAppState<>) => { (state: BaseAppState<>) => state.threadStore.threadInfos, threadInfoSelector, ( - rawThreadInfos: RawThreadInfos, + rawThreadInfos: LegacyRawThreadInfos, threadInfos: { +[id: string]: ThreadInfo }, ) => { const pendingToRealizedThreadIDs = @@ -415,10 +415,10 @@ const threadInfoFromSourceMessageIDSelector: (state: BaseAppState<>) => { }, ); const pendingToRealizedThreadIDsSelector: ( - rawThreadInfos: RawThreadInfos, + rawThreadInfos: LegacyRawThreadInfos, ) => $ReadOnlyMap = createSelector( - (rawThreadInfos: RawThreadInfos) => rawThreadInfos, - (rawThreadInfos: RawThreadInfos) => { + (rawThreadInfos: LegacyRawThreadInfos) => rawThreadInfos, + (rawThreadInfos: LegacyRawThreadInfos) => { const result = new Map(); for (const threadID in rawThreadInfos) { const rawThreadInfo = rawThreadInfos[threadID]; diff --git a/lib/selectors/user-selectors.js b/lib/selectors/user-selectors.js index 8823764716..07f84607ef 100644 --- a/lib/selectors/user-selectors.js +++ b/lib/selectors/user-selectors.js @@ -15,9 +15,9 @@ import type { BaseAppState } from '../types/redux-types.js'; import { userRelationshipStatus } from '../types/relationship-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; import { - type RawThreadInfo, + type LegacyRawThreadInfo, type LegacyRelativeMemberInfo, - type RawThreadInfos, + type LegacyRawThreadInfos, type RelativeMemberInfo, } from '../types/thread-types.js'; import type { @@ -55,7 +55,7 @@ function userIDsToRelativeUserInfos( } function getRelativeMemberInfos( - threadInfo: ?RawThreadInfo, + threadInfo: ?LegacyRawThreadInfo, currentUserID: ?string, userInfos: UserInfos, ): $ReadOnlyArray { @@ -210,7 +210,7 @@ const usersWithPersonalThreadSelector: ( ) => $ReadOnlySet = createSelector( (state: BaseAppState<>) => state.currentUserInfo && state.currentUserInfo.id, (state: BaseAppState<>) => state.threadStore.threadInfos, - (viewerID: ?string, threadInfos: RawThreadInfos) => { + (viewerID: ?string, threadInfos: LegacyRawThreadInfos) => { const personalThreadMembers = new Set(); for (const threadID in threadInfos) { diff --git a/lib/shared/avatar-utils.js b/lib/shared/avatar-utils.js index 2bb58275bb..8c98ee21fe 100644 --- a/lib/shared/avatar-utils.js +++ b/lib/shared/avatar-utils.js @@ -21,7 +21,10 @@ import type { MinimallyEncodedThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; -import { type RawThreadInfo, type ThreadInfo } from '../types/thread-types.js'; +import { + type LegacyRawThreadInfo, + type ThreadInfo, +} 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'; @@ -275,7 +278,7 @@ function getAvatarForUser(user: ?GenericUserInfoWithAvatar): ClientAvatar { function getUserAvatarForThread( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -305,7 +308,7 @@ function getUserAvatarForThread( function getAvatarForThread( thread: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo, @@ -326,7 +329,7 @@ function getAvatarForThread( function useAvatarForThread( thread: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js index 0f9cf63811..f24bedb0df 100644 --- a/lib/shared/message-utils.js +++ b/lib/shared/message-utils.js @@ -45,7 +45,7 @@ import type { MinimallyEncodedRawThreadInfo, MinimallyEncodedThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; -import type { RawThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { LegacyRawThreadInfo, ThreadInfo } from '../types/thread-types.js'; import type { UserInfos } from '../types/user-types.js'; import { extractKeyserverIDFromID } from '../utils/action-utils.js'; import { @@ -684,7 +684,7 @@ function isInvalidPinSource( function isInvalidPinSourceForThread( messageInfo: RawMessageInfo | MessageInfo, threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, diff --git a/lib/shared/state-sync/threads-state-sync-spec.js b/lib/shared/state-sync/threads-state-sync-spec.js index 0e95d5b04a..fbe93e34a6 100644 --- a/lib/shared/state-sync/threads-state-sync-spec.js +++ b/lib/shared/state-sync/threads-state-sync-spec.js @@ -11,8 +11,8 @@ import { } from '../../types/report-types.js'; import type { ProcessServerRequestAction } from '../../types/request-types.js'; import { - type RawThreadInfos, - type RawThreadInfo, + type LegacyRawThreadInfos, + type LegacyRawThreadInfo, } from '../../types/thread-types.js'; import { actionLogger } from '../../utils/action-logger.js'; import { getConfig } from '../../utils/config.js'; @@ -24,8 +24,8 @@ import { ashoatKeyserverID } from '../../utils/validation-utils.js'; const selector: ( state: AppState, ) => BoundStateSyncSpec< - RawThreadInfos, - RawThreadInfo, + LegacyRawThreadInfos, + LegacyRawThreadInfo, $ReadOnlyArray, > = createSelector( (state: AppState) => state.integrityStore.threadHashes, @@ -43,8 +43,8 @@ const selector: ( ); export const threadsStateSyncSpec: StateSyncSpec< - RawThreadInfos, - RawThreadInfo, + LegacyRawThreadInfos, + LegacyRawThreadInfo, $ReadOnlyArray, > = Object.freeze({ hashKey: 'threadInfos', @@ -55,8 +55,8 @@ export const threadsStateSyncSpec: StateSyncSpec< }, findStoreInconsistencies( action: ProcessServerRequestAction, - beforeStateCheck: RawThreadInfos, - afterStateCheck: RawThreadInfos, + beforeStateCheck: LegacyRawThreadInfos, + afterStateCheck: LegacyRawThreadInfos, ) { if (_isEqual(beforeStateCheck)(afterStateCheck)) { return emptyArray; diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js index 966418e3d8..f62615efe7 100644 --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -80,7 +80,7 @@ import { assertThreadType, } from '../types/thread-types-enum.js'; import { - type RawThreadInfo, + type LegacyRawThreadInfo, type ThreadInfo, type MemberInfo, type ServerThreadInfo, @@ -123,7 +123,7 @@ import { pendingThreadIDRegex } from '../utils/validation-utils.js'; function threadHasPermission( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -146,7 +146,7 @@ function threadHasPermission( function viewerIsMember( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -161,7 +161,7 @@ function viewerIsMember( function threadIsInHome( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -173,7 +173,7 @@ function threadIsInHome( function threadInChatList( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -187,7 +187,7 @@ function threadInChatList( function threadIsTopLevel( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -198,7 +198,7 @@ function threadIsTopLevel( function threadIsChannel( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -209,7 +209,7 @@ function threadIsChannel( function threadIsSidebar( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -220,7 +220,7 @@ function threadIsSidebar( function threadInBackgroundChatList( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -231,7 +231,7 @@ function threadInBackgroundChatList( function threadInHomeChatList( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -244,7 +244,7 @@ function threadInHomeChatList( function threadInFilterList( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -259,7 +259,7 @@ function threadInFilterList( function userIsMember( threadInfo: ?( | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo ), @@ -294,7 +294,7 @@ function threadOtherMembers( function threadMembersWithoutAddedAshoat< T: | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, >(threadInfo: T): $PropertyType { @@ -314,7 +314,7 @@ function threadIsGroupChat( function threadOrParentThreadIsGroupChat( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -333,7 +333,7 @@ function threadIsPendingSidebar(threadID: ?string): boolean { function getSingleOtherUser( threadInfo: | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, viewerID: ?string, @@ -815,7 +815,7 @@ function rawThreadInfoFromServerThreadInfo( serverThreadInfo: ServerThreadInfo, viewerID: string, options?: RawThreadInfoOptions, -): ?RawThreadInfo { +): ?LegacyRawThreadInfo { const filterThreadEditAvatarPermission = options?.filterThreadEditAvatarPermission; const excludePinInfo = options?.excludePinInfo; @@ -967,7 +967,7 @@ function threadUIName( } function threadInfoFromRawThreadInfo( - rawThreadInfo: RawThreadInfo, + rawThreadInfo: LegacyRawThreadInfo, viewerID: ?string, userInfos: UserInfos, ): ThreadInfo { @@ -1016,7 +1016,7 @@ function threadInfoFromRawThreadInfo( } function getCurrentUser( - threadInfo: RawThreadInfo | ThreadInfo, + threadInfo: LegacyRawThreadInfo | ThreadInfo, viewerID: ?string, userInfos: UserInfos, ): ThreadCurrentUserInfo { @@ -1057,7 +1057,7 @@ function getMinimallyEncodedCurrentUser( function threadIsWithBlockedUserOnly( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1093,7 +1093,7 @@ function threadIsWithBlockedUserOnly( function threadFrozenDueToBlock( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1105,7 +1105,7 @@ function threadFrozenDueToBlock( function threadFrozenDueToViewerBlock( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1126,7 +1126,7 @@ function memberIsAdmin( memberInfo: RelativeMemberInfo | MemberInfo, threadInfo: | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, ): boolean { @@ -1152,7 +1152,7 @@ function roleIsAdminRole(roleInfo: ?RoleInfo): boolean { function threadHasAdminRole( threadInfo: ?( - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | ServerThreadInfo | MinimallyEncodedRawThreadInfo @@ -1167,7 +1167,7 @@ function threadHasAdminRole( function threadOrParentThreadHasAdminRole( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1422,7 +1422,7 @@ function getThreadTypeParentRequirement( function threadMemberHasPermission( threadInfo: | ServerThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1508,7 +1508,7 @@ function draftKeyFromThreadID(threadID: string): string { function getContainingThreadID( parentThreadInfo: | ?ServerThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1529,7 +1529,7 @@ function getContainingThreadID( function getCommunity( parentThreadInfo: | ?ServerThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1756,7 +1756,7 @@ function patchThreadInfoToIncludeMentionedMembersOfParent( function threadInfoInsideCommunity( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1838,7 +1838,7 @@ function useRoleUserSurfacedPermissions( function communityOrThreadNoun( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, @@ -1850,7 +1850,7 @@ function communityOrThreadNoun( function getThreadsToDeleteText( threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, diff --git a/lib/shared/updates/delete-account-spec.js b/lib/shared/updates/delete-account-spec.js index 0d88e96333..d6a9447d22 100644 --- a/lib/shared/updates/delete-account-spec.js +++ b/lib/shared/updates/delete-account-spec.js @@ -3,7 +3,7 @@ import t from 'tcomb'; import type { UpdateSpec } from './update-spec.js'; -import type { RawThreadInfos } from '../../types/thread-types.js'; +import type { LegacyRawThreadInfos } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { AccountDeletionRawUpdateInfo, @@ -19,7 +19,7 @@ export const deleteAccountSpec: UpdateSpec< AccountDeletionUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: RawThreadInfos, + storeThreadInfos: LegacyRawThreadInfos, update: AccountDeletionUpdateInfo, ) { const operations = []; diff --git a/lib/shared/updates/delete-thread-spec.js b/lib/shared/updates/delete-thread-spec.js index 23e4170791..fc80d349db 100644 --- a/lib/shared/updates/delete-thread-spec.js +++ b/lib/shared/updates/delete-thread-spec.js @@ -3,7 +3,7 @@ import t from 'tcomb'; import type { UpdateSpec } from './update-spec.js'; -import type { RawThreadInfos } from '../../types/thread-types.js'; +import type { LegacyRawThreadInfos } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { ThreadDeletionRawUpdateInfo, @@ -18,7 +18,7 @@ export const deleteThreadSpec: UpdateSpec< ThreadDeletionUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: RawThreadInfos, + storeThreadInfos: LegacyRawThreadInfos, update: ThreadDeletionUpdateInfo, ) { if (storeThreadInfos[update.threadID]) { diff --git a/lib/shared/updates/join-thread-spec.js b/lib/shared/updates/join-thread-spec.js index 44a2eba9e6..a70d469e0c 100644 --- a/lib/shared/updates/join-thread-spec.js +++ b/lib/shared/updates/join-thread-spec.js @@ -18,8 +18,8 @@ import { rawMessageInfoValidator, } from '../../types/message-types.js'; import { - type RawThreadInfos, - rawThreadInfoValidator, + type LegacyRawThreadInfos, + legacyRawThreadInfoValidator, } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { @@ -37,7 +37,7 @@ export const joinThreadSpec: UpdateSpec< ThreadJoinUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: RawThreadInfos, + storeThreadInfos: LegacyRawThreadInfos, update: ThreadJoinUpdateInfo, ) { if (_isEqual(storeThreadInfos[update.threadInfo.id])(update.threadInfo)) { @@ -171,7 +171,7 @@ export const joinThreadSpec: UpdateSpec< type: tNumber(updateTypes.JOIN_THREAD), id: t.String, time: t.Number, - threadInfo: rawThreadInfoValidator, + threadInfo: legacyRawThreadInfoValidator, rawMessageInfos: t.list(rawMessageInfoValidator), truncationStatus: messageTruncationStatusValidator, rawEntryInfos: t.list(rawEntryInfoValidator), diff --git a/lib/shared/updates/update-spec.js b/lib/shared/updates/update-spec.js index 8118bf8e19..6d94ffa49b 100644 --- a/lib/shared/updates/update-spec.js +++ b/lib/shared/updates/update-spec.js @@ -14,7 +14,7 @@ import type { MessageTruncationStatuses, FetchMessageInfosResult, } from '../../types/message-types.js'; -import type { RawThreadInfos } from '../../types/thread-types.js'; +import type { LegacyRawThreadInfos } from '../../types/thread-types.js'; import type { UpdateType } from '../../types/update-types-enum.js'; import type { ClientUpdateInfo, @@ -28,7 +28,7 @@ import type { } from '../../types/user-types.js'; export type UpdateInfosRawData = { - +threadInfos: RawThreadInfos, + +threadInfos: LegacyRawThreadInfos, +messageInfosResult: ?FetchMessageInfosResult, +calendarResult: ?FetchEntryInfosBase, +entryInfosResult: ?RawEntryInfos, @@ -54,7 +54,7 @@ export type UpdateSpec< Data: UpdateData, > = { +generateOpsForThreadUpdates?: ( - storeThreadInfos: RawThreadInfos, + storeThreadInfos: LegacyRawThreadInfos, update: UpdateInfo, ) => ?$ReadOnlyArray, +mergeEntryInfos?: ( diff --git a/lib/shared/updates/update-thread-read-status-spec.js b/lib/shared/updates/update-thread-read-status-spec.js index b8cbe7b8d2..cbcc29826e 100644 --- a/lib/shared/updates/update-thread-read-status-spec.js +++ b/lib/shared/updates/update-thread-read-status-spec.js @@ -4,8 +4,8 @@ import t from 'tcomb'; import type { UpdateSpec } from './update-spec.js'; import type { - RawThreadInfo, - RawThreadInfos, + LegacyRawThreadInfo, + LegacyRawThreadInfos, } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { @@ -21,10 +21,11 @@ export const updateThreadReadStatusSpec: UpdateSpec< ThreadReadStatusUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: RawThreadInfos, + storeThreadInfos: LegacyRawThreadInfos, update: ThreadReadStatusUpdateInfo, ) { - const storeThreadInfo: ?RawThreadInfo = storeThreadInfos[update.threadID]; + const storeThreadInfo: ?LegacyRawThreadInfo = + storeThreadInfos[update.threadID]; if ( !storeThreadInfo || storeThreadInfo.currentUser.unread === update.unread diff --git a/lib/shared/updates/update-thread-spec.js b/lib/shared/updates/update-thread-spec.js index 151b8fdd8e..be99b85419 100644 --- a/lib/shared/updates/update-thread-spec.js +++ b/lib/shared/updates/update-thread-spec.js @@ -5,8 +5,8 @@ import t from 'tcomb'; import type { UpdateInfoFromRawInfoParams, UpdateSpec } from './update-spec.js'; import { - type RawThreadInfos, - rawThreadInfoValidator, + type LegacyRawThreadInfos, + legacyRawThreadInfoValidator, } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { @@ -23,7 +23,7 @@ export const updateThreadSpec: UpdateSpec< ThreadUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: RawThreadInfos, + storeThreadInfos: LegacyRawThreadInfos, update: ThreadUpdateInfo, ) { if (_isEqual(storeThreadInfos[update.threadInfo.id])(update.threadInfo)) { @@ -114,6 +114,6 @@ export const updateThreadSpec: UpdateSpec< type: tNumber(updateTypes.UPDATE_THREAD), id: t.String, time: t.Number, - threadInfo: rawThreadInfoValidator, + threadInfo: legacyRawThreadInfoValidator, }), }); diff --git a/lib/shared/user-utils.js b/lib/shared/user-utils.js index c9ebf5d0ee..ab30b74fd5 100644 --- a/lib/shared/user-utils.js +++ b/lib/shared/user-utils.js @@ -7,7 +7,7 @@ import type { MinimallyEncodedThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; import type { - RawThreadInfo, + LegacyRawThreadInfo, ServerThreadInfo, ThreadInfo, } from '../types/thread-types.js'; @@ -39,7 +39,7 @@ function stringForUserExplicit(user: ?{ +username: ?string, ... }): string { function useKeyserverAdmin( community: | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | ServerThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo, diff --git a/lib/types/account-types.js b/lib/types/account-types.js index 7d45f7eef9..bd4afea9b6 100644 --- a/lib/types/account-types.js +++ b/lib/types/account-types.js @@ -15,7 +15,7 @@ import { type GenericMessagesResult, } from './message-types.js'; import type { PreRequestUserState } from './session-types.js'; -import { type RawThreadInfos } from './thread-types.js'; +import { type LegacyRawThreadInfos } from './thread-types.js'; import { type UserInfo, type LoggedOutUserInfo, @@ -69,7 +69,7 @@ export type RegisterResponse = { rawMessageInfos: $ReadOnlyArray, currentUserInfo: LoggedInUserInfo, cookieChange: { - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, userInfos: $ReadOnlyArray, }, }; @@ -77,7 +77,7 @@ export type RegisterResponse = { export type RegisterResult = { +currentUserInfo: LoggedInUserInfo, +rawMessageInfos: $ReadOnlyArray, - +threadInfos: RawThreadInfos, + +threadInfos: LegacyRawThreadInfos, +userInfos: $ReadOnlyArray, +calendarQuery: CalendarQuery, }; @@ -142,14 +142,14 @@ export type LogInResponse = { +rawEntryInfos?: ?$ReadOnlyArray, +serverTime: number, +cookieChange: { - +threadInfos: RawThreadInfos, + +threadInfos: LegacyRawThreadInfos, +userInfos: $ReadOnlyArray, }, +notAcknowledgedPolicies?: $ReadOnlyArray, }; export type LogInResult = { - +threadInfos: RawThreadInfos, + +threadInfos: LegacyRawThreadInfos, +currentUserInfo: LoggedInUserInfo, +messagesResult: GenericMessagesResult, +userInfos: $ReadOnlyArray, diff --git a/lib/types/minimally-encoded-thread-permissions-types.js b/lib/types/minimally-encoded-thread-permissions-types.js index c2bbf4cb21..aaccbc72c4 100644 --- a/lib/types/minimally-encoded-thread-permissions-types.js +++ b/lib/types/minimally-encoded-thread-permissions-types.js @@ -4,7 +4,7 @@ import _mapValues from 'lodash/fp/mapValues.js'; import type { LegacyMemberInfo, - RawThreadInfo, + LegacyRawThreadInfo, LegacyRelativeMemberInfo, LegacyRoleInfo, ThreadCurrentUserInfo, @@ -122,7 +122,7 @@ const decodeMinimallyEncodedRelativeMemberInfo = ( }; export type MinimallyEncodedRawThreadInfo = $ReadOnly<{ - ...RawThreadInfo, + ...LegacyRawThreadInfo, +minimallyEncoded: true, +members: $ReadOnlyArray, +roles: { +[id: string]: MinimallyEncodedRoleInfo }, @@ -130,7 +130,7 @@ export type MinimallyEncodedRawThreadInfo = $ReadOnly<{ }>; const minimallyEncodeRawThreadInfo = ( - rawThreadInfo: RawThreadInfo, + rawThreadInfo: LegacyRawThreadInfo, ): MinimallyEncodedRawThreadInfo => { const { members, roles, currentUser, ...rest } = rawThreadInfo; return { @@ -144,7 +144,7 @@ const minimallyEncodeRawThreadInfo = ( const decodeMinimallyEncodedRawThreadInfo = ( minimallyEncodedRawThreadInfo: MinimallyEncodedRawThreadInfo, -): RawThreadInfo => { +): LegacyRawThreadInfo => { const { minimallyEncoded, members, roles, currentUser, ...rest } = minimallyEncodedRawThreadInfo; return { diff --git a/lib/types/report-types.js b/lib/types/report-types.js index ceabebce60..1805bae5fc 100644 --- a/lib/types/report-types.js +++ b/lib/types/report-types.js @@ -7,7 +7,7 @@ import { type PlatformDetails } from './device-types.js'; import { type RawEntryInfo, type CalendarQuery } from './entry-types.js'; import { type MediaMission } from './media-types.js'; import type { AppState, BaseAction } from './redux-types.js'; -import { type RawThreadInfos } from './thread-types.js'; +import { type LegacyRawThreadInfos } from './thread-types.js'; import type { UserInfo, UserInfos } from './user-types.js'; import { tPlatformDetails, tShape } from '../utils/validation-utils.js'; @@ -71,10 +71,10 @@ export type ActionSummary = { }; export type ThreadInconsistencyReportShape = { +platformDetails: PlatformDetails, - +beforeAction: RawThreadInfos, + +beforeAction: LegacyRawThreadInfos, +action: BaseAction, - +pollResult?: ?RawThreadInfos, - +pushResult: RawThreadInfos, + +pollResult?: ?LegacyRawThreadInfos, + +pushResult: LegacyRawThreadInfos, +lastActionTypes?: ?$ReadOnlyArray<$PropertyType>, +lastActions?: ?$ReadOnlyArray, +time?: ?number, @@ -139,9 +139,9 @@ export type ReportCreationRequest = export type ClientThreadInconsistencyReportShape = { +platformDetails: PlatformDetails, - +beforeAction: RawThreadInfos, + +beforeAction: LegacyRawThreadInfos, +action: BaseAction, - +pushResult: RawThreadInfos, + +pushResult: LegacyRawThreadInfos, +lastActions: $ReadOnlyArray, +time: number, }; diff --git a/lib/types/request-types.js b/lib/types/request-types.js index 477fb8f5a9..a3330f6d84 100644 --- a/lib/types/request-types.js +++ b/lib/types/request-types.js @@ -18,7 +18,10 @@ import type { ClientThreadInconsistencyReportShape, ClientEntryInconsistencyReportShape, } from './report-types.js'; -import { type RawThreadInfo, rawThreadInfoValidator } from './thread-types.js'; +import { + type LegacyRawThreadInfo, + legacyRawThreadInfoValidator, +} from './thread-types.js'; import { type CurrentUserInfo, currentUserInfoValidator, @@ -102,7 +105,7 @@ type FailUnmentioned = Partial<{ }>; type StateChanges = Partial<{ - +rawThreadInfos: RawThreadInfo[], + +rawThreadInfos: LegacyRawThreadInfo[], +rawEntryInfos: RawEntryInfo[], +currentUserInfo: CurrentUserInfo, +userInfos: AccountUserInfo[], @@ -130,7 +133,7 @@ const serverCheckStateServerRequestValidator = ), stateChanges: t.maybe( tShape({ - rawThreadInfos: t.maybe(t.list(rawThreadInfoValidator)), + rawThreadInfos: t.maybe(t.list(legacyRawThreadInfoValidator)), rawEntryInfos: t.maybe(t.list(rawEntryInfoValidator)), currentUserInfo: t.maybe(currentUserInfoValidator), userInfos: t.maybe(t.list(accountUserInfoValidator)), @@ -227,7 +230,7 @@ export type ClientCheckStateServerRequest = { +userInfos: boolean, }>, +stateChanges?: Partial<{ - +rawThreadInfos: RawThreadInfo[], + +rawThreadInfos: LegacyRawThreadInfo[], +rawEntryInfos: RawEntryInfo[], +currentUserInfo: CurrentUserInfo, +userInfos: AccountUserInfo[], diff --git a/lib/types/session-types.js b/lib/types/session-types.js index 996971eba4..ed440fc363 100644 --- a/lib/types/session-types.js +++ b/lib/types/session-types.js @@ -4,7 +4,7 @@ import t, { type TInterface } from 'tcomb'; import type { LogInActionSource } from './account-types.js'; import type { CalendarQuery } from './entry-types.js'; -import type { RawThreadInfos } from './thread-types.js'; +import type { LegacyRawThreadInfos } from './thread-types.js'; import { type UserInfo, type CurrentUserInfo, @@ -37,14 +37,14 @@ export type CookieType = $Values; export type ServerSessionChange = | { cookieInvalidated: false, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, userInfos: $ReadOnlyArray, sessionID?: null | string, cookie?: string, } | { cookieInvalidated: true, - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, userInfos: $ReadOnlyArray, currentUserInfo: LoggedOutUserInfo, sessionID?: null | string, diff --git a/lib/types/socket-types.js b/lib/types/socket-types.js index d6627cbc11..5ed4b69328 100644 --- a/lib/types/socket-types.js +++ b/lib/types/socket-types.js @@ -33,7 +33,10 @@ import { type ClientClientResponse, } from './request-types.js'; import type { SessionState, SessionIdentification } from './session-types.js'; -import { rawThreadInfoValidator, type RawThreadInfos } from './thread-types.js'; +import { + legacyRawThreadInfoValidator, + type LegacyRawThreadInfos, +} from './thread-types.js'; import { type ClientUpdatesResult, type ClientUpdatesResultWithUserInfos, @@ -183,14 +186,14 @@ export const stateSyncPayloadTypes = Object.freeze({ export const fullStateSyncActionType = 'FULL_STATE_SYNC'; export type BaseFullStateSync = { +messagesResult: MessagesResponse, - +threadInfos: RawThreadInfos, + +threadInfos: LegacyRawThreadInfos, +rawEntryInfos: $ReadOnlyArray, +userInfos: $ReadOnlyArray, +updatesCurrentAsOf: number, }; const baseFullStateSyncValidator = tShape({ messagesResult: messagesResponseValidator, - threadInfos: t.dict(tID, rawThreadInfoValidator), + threadInfos: t.dict(tID, legacyRawThreadInfoValidator), rawEntryInfos: t.list(rawEntryInfoValidator), userInfos: t.list(userInfoValidator), updatesCurrentAsOf: t.Number, diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js index 7cafaf8dd5..6a85929881 100644 --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -101,7 +101,7 @@ export const threadCurrentUserInfoValidator: TInterface = unread: t.maybe(t.Boolean), }); -export type RawThreadInfo = { +export type LegacyRawThreadInfo = { +id: string, +type: ThreadType, +name: ?string, @@ -119,11 +119,11 @@ export type RawThreadInfo = { +repliesCount: number, +pinnedCount?: number, }; -export type RawThreadInfos = { - +[id: string]: RawThreadInfo, +export type LegacyRawThreadInfos = { + +[id: string]: LegacyRawThreadInfo, }; -export const rawThreadInfoValidator: TInterface = - tShape({ +export const legacyRawThreadInfoValidator: TInterface = + tShape({ id: tID, type: threadTypeValidator, name: t.maybe(t.String), @@ -230,11 +230,11 @@ export type ServerThreadInfo = { }; export type ThreadStore = { - +threadInfos: RawThreadInfos, + +threadInfos: LegacyRawThreadInfos, }; export const threadStoreValidator: TInterface = tShape({ - threadInfos: t.dict(tID, rawThreadInfoValidator), + threadInfos: t.dict(tID, legacyRawThreadInfoValidator), }); export type ClientDBThreadInfo = { @@ -434,14 +434,14 @@ type EditRoleAction = { export type RoleModificationRequest = CreateRoleAction | EditRoleAction; export type RoleModificationResult = { - +threadInfo: RawThreadInfo, + +threadInfo: LegacyRawThreadInfo, +updatesResult: { +newUpdates: $ReadOnlyArray, }, }; export type RoleModificationPayload = { - +threadInfo: RawThreadInfo, + +threadInfo: LegacyRawThreadInfo, +updatesResult: { +newUpdates: $ReadOnlyArray, }, @@ -453,14 +453,14 @@ export type RoleDeletionRequest = { }; export type RoleDeletionResult = { - +threadInfo: RawThreadInfo, + +threadInfo: LegacyRawThreadInfo, +updatesResult: { +newUpdates: $ReadOnlyArray, }, }; export type RoleDeletionPayload = { - +threadInfo: RawThreadInfo, + +threadInfo: LegacyRawThreadInfo, +updatesResult: { +newUpdates: $ReadOnlyArray, }, @@ -474,7 +474,7 @@ export const maxReadSidebars = 3; // in the chat tab if every one of the displayed sidebars is unread export const maxUnreadSidebars = 5; -export type ThreadStoreThreadInfos = RawThreadInfos; +export type ThreadStoreThreadInfos = LegacyRawThreadInfos; export type ChatMentionCandidates = { +[id: string]: ResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo, diff --git a/lib/types/update-types.js b/lib/types/update-types.js index 85afe26d46..4269013e8d 100644 --- a/lib/types/update-types.js +++ b/lib/types/update-types.js @@ -7,7 +7,7 @@ import { type RawMessageInfo, type MessageTruncationStatus, } from './message-types.js'; -import { type RawThreadInfo } from './thread-types.js'; +import { type LegacyRawThreadInfo } from './thread-types.js'; import { type UserInfo, userInfoValidator, @@ -183,7 +183,7 @@ export type ThreadUpdateInfo = { +type: 1, +id: string, +time: number, - +threadInfo: RawThreadInfo, + +threadInfo: LegacyRawThreadInfo, }; export type ThreadReadStatusUpdateInfo = { @@ -205,7 +205,7 @@ export type ThreadJoinUpdateInfo = { +type: 4, +id: string, +time: number, - +threadInfo: RawThreadInfo, + +threadInfo: LegacyRawThreadInfo, +rawMessageInfos: $ReadOnlyArray, +truncationStatus: MessageTruncationStatus, +rawEntryInfos: $ReadOnlyArray, diff --git a/lib/types/validation.test.js b/lib/types/validation.test.js index fc39d3b3a8..9d81b94a32 100644 --- a/lib/types/validation.test.js +++ b/lib/types/validation.test.js @@ -22,7 +22,7 @@ import { serverUpdatesServerSocketMessageValidator, } from './socket-types.js'; import { threadTypes } from './thread-types-enum.js'; -import { rawThreadInfoValidator } from './thread-types.js'; +import { legacyRawThreadInfoValidator } from './thread-types.js'; import { updateTypes } from './update-types-enum.js'; import { messageSpecs } from '../shared/messages/message-specs.js'; import { updateSpecs } from '../shared/updates/update-specs.js'; @@ -629,11 +629,11 @@ const thread = { describe('thread validation', () => { it('should validate correct thread', () => { - expect(rawThreadInfoValidator.is(thread)).toBe(true); + expect(legacyRawThreadInfoValidator.is(thread)).toBe(true); }); it('should not validate incorrect thread', () => { expect( - rawThreadInfoValidator.is({ ...thread, creationTime: undefined }), + legacyRawThreadInfoValidator.is({ ...thread, creationTime: undefined }), ).toBe(false); }); }); diff --git a/lib/utils/drawer-utils.react.js b/lib/utils/drawer-utils.react.js index a4eac824b9..3ca11e7da3 100644 --- a/lib/utils/drawer-utils.react.js +++ b/lib/utils/drawer-utils.react.js @@ -9,7 +9,7 @@ import type { } from '../types/minimally-encoded-thread-permissions-types.js'; import { communitySubthreads } from '../types/thread-types-enum.js'; import type { - RawThreadInfo, + LegacyRawThreadInfo, ThreadInfo, ResolvedThreadInfo, } from '../types/thread-types.js'; @@ -109,7 +109,7 @@ function filterThreadIDsBelongingToCommunity( threadInfosObj: { +[id: string]: | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo, }, diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js index 70f9644f52..f8bed1fb22 100644 --- a/lib/utils/entity-text.js +++ b/lib/utils/entity-text.js @@ -18,7 +18,10 @@ import { threadTypes, threadTypeValidator, } from '../types/thread-types-enum.js'; -import { type RawThreadInfo, type ThreadInfo } from '../types/thread-types.js'; +import { + type LegacyRawThreadInfo, + type ThreadInfo, +} from '../types/thread-types.js'; import { basePluralize } from '../utils/text-utils.js'; export type UserEntity = { @@ -144,7 +147,7 @@ type EntityTextThreadInput = +display?: 'shortName', +threadInfo: | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo, +subchannel?: ?boolean, @@ -154,7 +157,7 @@ type EntityTextThreadInput = +display: 'alwaysDisplayShortName', +threadInfo: | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo, +possessive?: ?boolean, diff --git a/lib/utils/thread-ops-utils.js b/lib/utils/thread-ops-utils.js index e43afce730..f753b2950f 100644 --- a/lib/utils/thread-ops-utils.js +++ b/lib/utils/thread-ops-utils.js @@ -3,11 +3,11 @@ import { assertThreadType } from '../types/thread-types-enum.js'; import { type ClientDBThreadInfo, - type RawThreadInfo, + type LegacyRawThreadInfo, } from '../types/thread-types.js'; function convertRawThreadInfoToClientDBThreadInfo( - rawThreadInfo: RawThreadInfo, + rawThreadInfo: LegacyRawThreadInfo, ): ClientDBThreadInfo { return { ...rawThreadInfo, @@ -21,8 +21,8 @@ function convertRawThreadInfoToClientDBThreadInfo( function convertClientDBThreadInfoToRawThreadInfo( clientDBThreadInfo: ClientDBThreadInfo, -): RawThreadInfo { - let rawThreadInfo: RawThreadInfo = { +): LegacyRawThreadInfo { + let rawThreadInfo: LegacyRawThreadInfo = { id: clientDBThreadInfo.id, type: assertThreadType(clientDBThreadInfo.type), name: clientDBThreadInfo.name, diff --git a/lib/utils/thread-ops-utils.test.js b/lib/utils/thread-ops-utils.test.js index 0c1e745984..d1c374759a 100644 --- a/lib/utils/thread-ops-utils.test.js +++ b/lib/utils/thread-ops-utils.test.js @@ -6,10 +6,10 @@ import { } from './thread-ops-utils.js'; import type { ClientDBThreadInfo, - RawThreadInfo, + LegacyRawThreadInfo, } from '../types/thread-types.js'; -const rawThreadInfo: RawThreadInfo = { +const rawThreadInfo: LegacyRawThreadInfo = { id: '84015', type: 6, name: 'atul_web', @@ -405,7 +405,7 @@ describe('convertClientDBThreadInfoToRawThreadInfo', () => { }); }); -const rawThreadInfoWithAvatar: RawThreadInfo = { +const rawThreadInfoWithAvatar: LegacyRawThreadInfo = { ...rawThreadInfo, avatar: { type: 'emoji', color: '4b87aa', emoji: '😀' }, }; diff --git a/lib/utils/toggle-pin-utils.js b/lib/utils/toggle-pin-utils.js index 08a34dedb5..b1b09f8401 100644 --- a/lib/utils/toggle-pin-utils.js +++ b/lib/utils/toggle-pin-utils.js @@ -8,12 +8,12 @@ import type { MinimallyEncodedThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; -import type { RawThreadInfo, ThreadInfo } from '../types/thread-types.js'; +import type { LegacyRawThreadInfo, ThreadInfo } from '../types/thread-types.js'; function canToggleMessagePin( messageInfo: RawMessageInfo | MessageInfo, threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, diff --git a/native/avatars/edit-thread-avatar.react.js b/native/avatars/edit-thread-avatar.react.js index 2710193c74..e6246e40a0 100644 --- a/native/avatars/edit-thread-avatar.react.js +++ b/native/avatars/edit-thread-avatar.react.js @@ -10,7 +10,10 @@ import type { MinimallyEncodedRawThreadInfo, MinimallyEncodedThreadInfo, } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { RawThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { + LegacyRawThreadInfo, + ThreadInfo, +} from 'lib/types/thread-types.js'; import { useNativeSetThreadAvatar, @@ -27,7 +30,7 @@ import { useStyles } from '../themes/colors.js'; type Props = { +threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo, diff --git a/native/avatars/thread-avatar.react.js b/native/avatars/thread-avatar.react.js index cc33e0111d..a6c9c0874d 100644 --- a/native/avatars/thread-avatar.react.js +++ b/native/avatars/thread-avatar.react.js @@ -15,7 +15,7 @@ import type { } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; import type { - RawThreadInfo, + LegacyRawThreadInfo, ThreadInfo, ResolvedThreadInfo, } from 'lib/types/thread-types.js'; @@ -25,7 +25,7 @@ import { useSelector } from '../redux/redux-utils.js'; type Props = { +threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | ResolvedThreadInfo | MinimallyEncodedRawThreadInfo diff --git a/native/chat/settings/emoji-thread-avatar-creation.react.js b/native/chat/settings/emoji-thread-avatar-creation.react.js index 6d3285751e..bd4fd1c1ed 100644 --- a/native/chat/settings/emoji-thread-avatar-creation.react.js +++ b/native/chat/settings/emoji-thread-avatar-creation.react.js @@ -10,7 +10,10 @@ import type { MinimallyEncodedRawThreadInfo, MinimallyEncodedThreadInfo, } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { RawThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { + LegacyRawThreadInfo, + ThreadInfo, +} from 'lib/types/thread-types.js'; import { useNativeSetThreadAvatar } from '../../avatars/avatar-hooks.js'; import EmojiAvatarCreation from '../../avatars/emoji-avatar-creation.react.js'; @@ -21,7 +24,7 @@ import { useSelector } from '../../redux/redux-utils.js'; export type EmojiThreadAvatarCreationParams = { +threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, diff --git a/native/redux/client-db-utils.js b/native/redux/client-db-utils.js index a12f839731..a32c672dab 100644 --- a/native/redux/client-db-utils.js +++ b/native/redux/client-db-utils.js @@ -9,7 +9,7 @@ import type { } from 'lib/types/message-types.js'; import type { ClientDBThreadInfo, - RawThreadInfo, + LegacyRawThreadInfo, ThreadStoreThreadInfos, } from 'lib/types/thread-types.js'; import { @@ -71,7 +71,10 @@ function createUpdateDBOpsForThreadStoreThreadInfos( // Convert `rawThreadInfo`s to a map of `threadID` => `threadInfo`. const threadIDToThreadInfo = rawThreadInfos.reduce( - (acc: { [string]: RawThreadInfo }, threadInfo: RawThreadInfo) => { + ( + acc: { [string]: LegacyRawThreadInfo }, + threadInfo: LegacyRawThreadInfo, + ) => { acc[threadInfo.id] = threadInfo; return acc; }, @@ -83,7 +86,7 @@ function createUpdateDBOpsForThreadStoreThreadInfos( migrationFunc(threadIDToThreadInfo); // Convert the updated `threadInfo`s back into an array. - const updatedRawThreadInfos: $ReadOnlyArray = values( + const updatedRawThreadInfos: $ReadOnlyArray = values( updatedThreadIDToThreadInfo, ); diff --git a/native/redux/edit-thread-permission-migration.js b/native/redux/edit-thread-permission-migration.js index 38b2c4cbfd..1d406cf16e 100644 --- a/native/redux/edit-thread-permission-migration.js +++ b/native/redux/edit-thread-permission-migration.js @@ -4,14 +4,14 @@ import { threadTypes } from 'lib/types/thread-types-enum.js'; import type { LegacyMemberInfo, ThreadCurrentUserInfo, - RawThreadInfo, + LegacyRawThreadInfo, LegacyRoleInfo, - RawThreadInfos, + LegacyRawThreadInfos, } from 'lib/types/thread-types.js'; function addDetailedThreadEditPermissionsToUser< T: LegacyMemberInfo | ThreadCurrentUserInfo, ->(threadInfo: RawThreadInfo, member: T, threadID: string): T { +>(threadInfo: LegacyRawThreadInfo, member: T, threadID: string): T { let newPermissions = null; if (threadInfo.type === threadTypes.PRIVATE) { newPermissions = { @@ -59,11 +59,11 @@ function addDetailedThreadEditPermissionsToRole( } function migrateThreadStoreForEditThreadPermissions(threadInfos: { - +[id: string]: RawThreadInfo, -}): RawThreadInfos { - const newThreadInfos: { [string]: RawThreadInfo } = {}; + +[id: string]: LegacyRawThreadInfo, +}): LegacyRawThreadInfos { + const newThreadInfos: { [string]: LegacyRawThreadInfo } = {}; for (const threadID in threadInfos) { - const threadInfo: RawThreadInfo = threadInfos[threadID]; + const threadInfo: LegacyRawThreadInfo = threadInfos[threadID]; const updatedMembers = threadInfo.members.map(member => addDetailedThreadEditPermissionsToUser(threadInfo, member, threadID), ); diff --git a/native/redux/manage-pins-permission-migration.js b/native/redux/manage-pins-permission-migration.js index e82bd7ebdf..6f48586439 100644 --- a/native/redux/manage-pins-permission-migration.js +++ b/native/redux/manage-pins-permission-migration.js @@ -1,21 +1,21 @@ // @flow import type { - RawThreadInfo, + LegacyRawThreadInfo, LegacyMemberInfo, ThreadCurrentUserInfo, LegacyRoleInfo, - RawThreadInfos, + LegacyRawThreadInfos, } from 'lib/types/thread-types.js'; -type ThreadStoreThreadInfos = RawThreadInfos; +type ThreadStoreThreadInfos = LegacyRawThreadInfos; const adminRoleName = 'Admins'; function addManagePinsThreadPermissionToUser< TargetMemberInfo: LegacyMemberInfo | ThreadCurrentUserInfo, >( - threadInfo: RawThreadInfo, + threadInfo: LegacyRawThreadInfo, member: TargetMemberInfo, threadID: string, ): TargetMemberInfo { @@ -59,9 +59,9 @@ function addManagePinsThreadPermissionToRole( function persistMigrationForManagePinsThreadPermission( threadInfos: ThreadStoreThreadInfos, ): ThreadStoreThreadInfos { - const newThreadInfos: { [string]: RawThreadInfo } = {}; + const newThreadInfos: { [string]: LegacyRawThreadInfo } = {}; for (const threadID in threadInfos) { - const threadInfo: RawThreadInfo = threadInfos[threadID]; + const threadInfo: LegacyRawThreadInfo = threadInfos[threadID]; const updatedMembers = threadInfo.members.map(member => addManagePinsThreadPermissionToUser(threadInfo, member, threadID), ); diff --git a/native/redux/persist.js b/native/redux/persist.js index 718e6b2d45..2c9da02785 100644 --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -72,7 +72,7 @@ import { import { defaultGlobalThemeInfo } from 'lib/types/theme-types.js'; import type { ClientDBThreadInfo, - RawThreadInfo, + LegacyRawThreadInfo, } from 'lib/types/thread-types.js'; import { translateClientDBMessageInfoToRawMessageInfo, @@ -259,7 +259,7 @@ const migrations = { }, }), [19]: (state: any) => { - const threadInfos: { [string]: RawThreadInfo } = {}; + const threadInfos: { [string]: LegacyRawThreadInfo } = {}; for (const threadID in state.threadStore.threadInfos) { const threadInfo = state.threadStore.threadInfos[threadID]; const { visibilityRules, ...rest } = threadInfo; @@ -379,7 +379,7 @@ const migrations = { return state; } - const threadInfos: { [string]: RawThreadInfo } = {}; + const threadInfos: { [string]: LegacyRawThreadInfo } = {}; const stack = [...rootIDs]; while (stack.length > 0) { const threadID = stack.shift(); @@ -523,7 +523,10 @@ const migrations = { // 8. Convert rawThreadInfos to a map of threadID to threadInfo const threadIDToThreadInfo = rawThreadInfosWithPinnedCount.reduce( - (acc: { [string]: RawThreadInfo }, threadInfo: RawThreadInfo) => { + ( + acc: { [string]: LegacyRawThreadInfo }, + threadInfo: LegacyRawThreadInfo, + ) => { acc[threadInfo.id] = threadInfo; return acc; }, @@ -932,7 +935,10 @@ const migrations = { convertClientDBThreadInfoToRawThreadInfo, ); const rawThreadInfosObject = rawThreadInfos.reduce( - (acc: { [string]: RawThreadInfo }, threadInfo: RawThreadInfo) => { + ( + acc: { [string]: LegacyRawThreadInfo }, + threadInfo: LegacyRawThreadInfo, + ) => { acc[threadInfo.id] = threadInfo; return acc; }, diff --git a/native/redux/remove-select-role-permissions.js b/native/redux/remove-select-role-permissions.js index 0816589ee1..21b290275a 100644 --- a/native/redux/remove-select-role-permissions.js +++ b/native/redux/remove-select-role-permissions.js @@ -1,15 +1,15 @@ // @flow import type { - RawThreadInfos, - RawThreadInfo, + LegacyRawThreadInfos, + LegacyRawThreadInfo, LegacyRoleInfo, } from 'lib/types/thread-types.js'; import { permissionsToRemoveInMigration } from 'lib/utils/migration-utils.js'; function persistMigrationToRemoveSelectRolePermissions( - rawThreadInfos: RawThreadInfos, -): RawThreadInfos { + rawThreadInfos: LegacyRawThreadInfos, +): LegacyRawThreadInfos { // This is to handle the client being logged out and not having any threads // to provide here. In this case, we want the migration to still succeed // so we early return an empty object. @@ -17,7 +17,7 @@ function persistMigrationToRemoveSelectRolePermissions( return {}; } - const updatedThreadInfos: { [string]: RawThreadInfo } = {}; + const updatedThreadInfos: { [string]: LegacyRawThreadInfo } = {}; for (const threadID in rawThreadInfos) { const threadInfo = rawThreadInfos[threadID]; const { roles } = threadInfo; diff --git a/native/redux/remove-select-role-permissions.test.js b/native/redux/remove-select-role-permissions.test.js index 0e45e187a9..2d42c65e4f 100644 --- a/native/redux/remove-select-role-permissions.test.js +++ b/native/redux/remove-select-role-permissions.test.js @@ -1,6 +1,6 @@ // @flow -import type { RawThreadInfos } from 'lib/types/thread-types.js'; +import type { LegacyRawThreadInfos } from 'lib/types/thread-types.js'; import { deepDiff } from 'lib/utils/objects.js'; import { persistMigrationToRemoveSelectRolePermissions } from './remove-select-role-permissions.js'; @@ -8,7 +8,7 @@ import { threadStoreThreadsWithIncorrectPermissions } from './update-roles-and-p describe('persistMigrationToRemoveDescendantOpenVoiced', () => { it("should correctly remove 'descendant_open_voiced' from permissions", () => { - const migratedRawThreadInfos: RawThreadInfos = + const migratedRawThreadInfos: LegacyRawThreadInfos = persistMigrationToRemoveSelectRolePermissions( threadStoreThreadsWithIncorrectPermissions, ); diff --git a/native/redux/update-roles-and-permissions.js b/native/redux/update-roles-and-permissions.js index c817a904a5..a7cc84d6f4 100644 --- a/native/redux/update-roles-and-permissions.js +++ b/native/redux/update-roles-and-permissions.js @@ -8,7 +8,7 @@ import { } from 'lib/permissions/thread-permissions.js'; import type { ThreadPermissionsBlob } from 'lib/types/thread-permission-types.js'; import type { - RawThreadInfo, + LegacyRawThreadInfo, ThreadStoreThreadInfos, LegacyMemberInfo, } from 'lib/types/thread-types.js'; @@ -56,7 +56,8 @@ function updateRolesAndPermissions( const recursivelyUpdateRoles = ( node: $ReadOnly, ): void => { - const threadInfo: RawThreadInfo = updatedThreadStoreInfos[node.threadID]; + const threadInfo: LegacyRawThreadInfo = + updatedThreadStoreInfos[node.threadID]; const computedRolePermissionBlobs = getRolePermissionBlobs(threadInfo.type); const roles = { ...threadInfo.roles }; @@ -78,7 +79,8 @@ function updateRolesAndPermissions( node: $ReadOnly, memberToThreadPermissionsFromParent: ?MemberToThreadPermissionsFromParent, ): void => { - const threadInfo: RawThreadInfo = updatedThreadStoreInfos[node.threadID]; + const threadInfo: LegacyRawThreadInfo = + updatedThreadStoreInfos[node.threadID]; const updatedMembers = []; const memberToThreadPermissionsForChildren: { @@ -123,7 +125,8 @@ function updateRolesAndPermissions( node: $ReadOnly, permissionsFromParent: ?ThreadPermissionsBlob, ): void => { - const threadInfo: RawThreadInfo = updatedThreadStoreInfos[node.threadID]; + const threadInfo: LegacyRawThreadInfo = + updatedThreadStoreInfos[node.threadID]; const { currentUser, roles } = threadInfo; const { role } = currentUser; diff --git a/native/selectors/message-selectors.js b/native/selectors/message-selectors.js index f83301d5e7..cd282b2505 100644 --- a/native/selectors/message-selectors.js +++ b/native/selectors/message-selectors.js @@ -6,7 +6,7 @@ import { threadIsPending } from 'lib/shared/thread-utils.js'; import type { ThreadMessageInfo } from 'lib/types/message-types.js'; import { defaultNumberPerThread } from 'lib/types/message-types.js'; import type { ThreadActivityStore } from 'lib/types/thread-activity-types.js'; -import { type RawThreadInfos } from 'lib/types/thread-types.js'; +import { type LegacyRawThreadInfos } from 'lib/types/thread-types.js'; import { activeThreadSelector } from '../navigation/nav-selectors.js'; import type { AppState } from '../redux/state-types.js'; @@ -19,7 +19,7 @@ const nextMessagePruneTimeSelector: (state: AppState) => ?number = (state: AppState) => state.threadStore.threadInfos, (state: AppState) => state.threadActivityStore, ( - threadInfos: RawThreadInfos, + threadInfos: LegacyRawThreadInfos, threadActivityStore: ThreadActivityStore, ): ?number => { let nextTime; diff --git a/web/avatars/edit-thread-avatar-menu.react.js b/web/avatars/edit-thread-avatar-menu.react.js index 91a2f6a0d0..da1ba777bd 100644 --- a/web/avatars/edit-thread-avatar-menu.react.js +++ b/web/avatars/edit-thread-avatar-menu.react.js @@ -10,7 +10,10 @@ import type { MinimallyEncodedRawThreadInfo, MinimallyEncodedThreadInfo, } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { RawThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { + LegacyRawThreadInfo, + ThreadInfo, +} from 'lib/types/thread-types.js'; import { useUploadAvatarMedia } from './avatar-hooks.react.js'; import css from './edit-avatar-menu.css'; @@ -27,7 +30,7 @@ const editIcon = ( type Props = { +threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo, diff --git a/web/avatars/edit-thread-avatar.react.js b/web/avatars/edit-thread-avatar.react.js index 6f590fbe2c..d30ed6418e 100644 --- a/web/avatars/edit-thread-avatar.react.js +++ b/web/avatars/edit-thread-avatar.react.js @@ -10,7 +10,10 @@ import type { MinimallyEncodedThreadInfo, } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; -import type { RawThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { + LegacyRawThreadInfo, + ThreadInfo, +} from 'lib/types/thread-types.js'; import EditThreadAvatarMenu from './edit-thread-avatar-menu.react.js'; import css from './edit-thread-avatar.css'; @@ -18,7 +21,7 @@ import ThreadAvatar from './thread-avatar.react.js'; type Props = { +threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, diff --git a/web/avatars/thread-avatar.react.js b/web/avatars/thread-avatar.react.js index 1636d9b56c..66cb7aecc8 100644 --- a/web/avatars/thread-avatar.react.js +++ b/web/avatars/thread-avatar.react.js @@ -13,14 +13,17 @@ import type { MinimallyEncodedThreadInfo, } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; -import { type RawThreadInfo, type ThreadInfo } from 'lib/types/thread-types.js'; +import { + type LegacyRawThreadInfo, + type ThreadInfo, +} from 'lib/types/thread-types.js'; import Avatar from './avatar.react.js'; import { useSelector } from '../redux/redux-utils.js'; type Props = { +threadInfo: - | RawThreadInfo + | LegacyRawThreadInfo | ThreadInfo | MinimallyEncodedRawThreadInfo | MinimallyEncodedThreadInfo, diff --git a/web/avatars/thread-emoji-avatar-selection-modal.react.js b/web/avatars/thread-emoji-avatar-selection-modal.react.js index ccd84d34d8..86e680d5d3 100644 --- a/web/avatars/thread-emoji-avatar-selection-modal.react.js +++ b/web/avatars/thread-emoji-avatar-selection-modal.react.js @@ -16,14 +16,17 @@ import type { MinimallyEncodedRawThreadInfo, MinimallyEncodedThreadInfo, } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { RawThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; +import type { + LegacyRawThreadInfo, + ThreadInfo, +} from 'lib/types/thread-types.js'; import EmojiAvatarSelectionModal from './emoji-avatar-selection-modal.react.js'; type Props = { +threadInfo: | ThreadInfo - | RawThreadInfo + | LegacyRawThreadInfo | MinimallyEncodedThreadInfo | MinimallyEncodedRawThreadInfo, }; diff --git a/web/redux/initial-state-gate.js b/web/redux/initial-state-gate.js index 7dacb7b604..9c42cd0de5 100644 --- a/web/redux/initial-state-gate.js +++ b/web/redux/initial-state-gate.js @@ -8,7 +8,7 @@ import { setClientDBStoreActionType } from 'lib/actions/client-db-store-actions. 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 { RawThreadInfo } from 'lib/types/thread-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'; import { useDispatch } from 'lib/utils/redux-utils.js'; @@ -97,7 +97,7 @@ function InitialReduxStateGate(props: Props): React.Node { const threadStoreOperations: ThreadStoreOperation[] = entries( threadInfos, - ).map(([id, threadInfo]: [string, RawThreadInfo]) => ({ + ).map(([id, threadInfo]: [string, LegacyRawThreadInfo]) => ({ type: 'replace', payload: { id, diff --git a/web/redux/nav-reducer.js b/web/redux/nav-reducer.js index f4e9005c4c..f6397c806c 100644 --- a/web/redux/nav-reducer.js +++ b/web/redux/nav-reducer.js @@ -2,7 +2,7 @@ import { pendingToRealizedThreadIDsSelector } from 'lib/selectors/thread-selectors.js'; import { threadIsPending } from 'lib/shared/thread-utils.js'; -import type { RawThreadInfos } from 'lib/types/thread-types.js'; +import type { LegacyRawThreadInfos } from 'lib/types/thread-types.js'; import { updateNavInfoActionType } from '../redux/action-types.js'; import type { Action } from '../redux/redux-setup.js'; @@ -11,7 +11,7 @@ import { type NavInfo } from '../types/nav-types.js'; export default function reduceNavInfo( oldState: NavInfo, action: Action, - newThreadInfos: RawThreadInfos, + newThreadInfos: LegacyRawThreadInfos, ): NavInfo { let state = oldState; if (action.type === updateNavInfoActionType) { diff --git a/web/selectors/thread-selectors.js b/web/selectors/thread-selectors.js index be4f8c923a..5ea0bd3d50 100644 --- a/web/selectors/thread-selectors.js +++ b/web/selectors/thread-selectors.js @@ -16,7 +16,10 @@ import type { RobotextMessageInfo, } from 'lib/types/message-types.js'; import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; -import type { ThreadInfo, RawThreadInfos } from 'lib/types/thread-types.js'; +import type { + ThreadInfo, + LegacyRawThreadInfos, +} from 'lib/types/thread-types.js'; import { values } from 'lib/utils/objects.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; @@ -141,7 +144,7 @@ const unreadCountInSelectedCommunity: (state: AppState) => number = createSelector( (state: AppState) => state.threadStore.threadInfos, (state: AppState) => state.communityPickerStore.chat, - (threadInfos: RawThreadInfos, communityID: ?string): number => + (threadInfos: LegacyRawThreadInfos, communityID: ?string): number => values(threadInfos).filter( threadInfo => threadInHomeChatList(threadInfo) &&