diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -50,7 +50,7 @@ SubscriptionUpdateRequest, SubscriptionUpdateResult, } from '../types/subscription-types.js'; -import type { MinimallyEncodedRawThreadInfos } from '../types/thread-types'; +import type { RawThreadInfos } from '../types/thread-types'; import type { UserInfo, PasswordUpdate, @@ -272,7 +272,7 @@ const userInfosArrays = []; - let threadInfos: MinimallyEncodedRawThreadInfos = {}; + let threadInfos: RawThreadInfos = {}; const calendarResult: WritableCalendarResult = { calendarQuery: keyserverAuthInfo.calendarQuery, rawEntryInfos: [], @@ -418,7 +418,7 @@ const userInfosArrays = []; - let threadInfos: MinimallyEncodedRawThreadInfos = {}; + let threadInfos: RawThreadInfos = {}; const calendarResult: WritableCalendarResult = { calendarQuery: logInInfo.calendarQuery, rawEntryInfos: [], 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 @@ -4,7 +4,7 @@ import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { ClientDBThreadInfo, - MinimallyEncodedRawThreadInfos, + RawThreadInfos, ThreadStore, } from '../types/thread-types.js'; import { @@ -45,7 +45,7 @@ ThreadStore, ThreadStoreOperation, ClientDBThreadStoreOperation, - MinimallyEncodedRawThreadInfos, + RawThreadInfos, ClientDBThreadInfo, > = { processStoreOperations( diff --git a/lib/reducers/calendar-filters-reducer.js b/lib/reducers/calendar-filters-reducer.js --- a/lib/reducers/calendar-filters-reducer.js +++ b/lib/reducers/calendar-filters-reducer.js @@ -41,10 +41,7 @@ fullStateSyncActionType, incrementalStateSyncActionType, } from '../types/socket-types.js'; -import type { - MinimallyEncodedRawThreadInfos, - ThreadStore, -} from '../types/thread-types.js'; +import type { RawThreadInfos, ThreadStore } from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -187,7 +184,7 @@ function removeDeletedThreadIDsFromFilterList( state: $ReadOnlyArray, - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, ): $ReadOnlyArray { const filterCondition = (threadID: string) => threadInFilterList(threadInfos[threadID]); diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js --- a/lib/reducers/entry-reducer.js +++ b/lib/reducers/entry-reducer.js @@ -56,7 +56,7 @@ fullStateSyncActionType, incrementalStateSyncActionType, } from '../types/socket-types.js'; -import type { MinimallyEncodedRawThreadInfos } from '../types/thread-types.js'; +import type { RawThreadInfos } from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -91,7 +91,7 @@ currentEntryInfos: { +[id: string]: RawEntryInfo }, currentDaysToEntries: ?{ +[day: string]: string[] }, newEntryInfos: $ReadOnlyArray, - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, ) { const mergedEntryInfos: { [string]: RawEntryInfo } = {}; let someEntryUpdated = false; @@ -164,7 +164,7 @@ function reduceEntryInfos( entryStore: EntryStore, action: BaseAction, - newThreadInfos: MinimallyEncodedRawThreadInfos, + newThreadInfos: RawThreadInfos, ): [EntryStore, $ReadOnlyArray] { const { entryInfos, daysToEntries, lastUserInteractionCalendar } = entryStore; if ( 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 @@ -98,7 +98,7 @@ import { threadPermissions } from '../types/thread-permission-types.js'; import type { LegacyRawThreadInfo, - MinimallyEncodedRawThreadInfos, + RawThreadInfos, MixedRawThreadInfos, } from '../types/thread-types.js'; import { @@ -217,7 +217,7 @@ function reassignMessagesToRealizedThreads( messageStore: MessageStore, - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, ): ReassignmentResult { const pendingToRealizedThreadIDs = pendingToRealizedThreadIDsSelector(threadInfos); @@ -310,7 +310,7 @@ oldMessageStore: MessageStore, newMessageInfos: $ReadOnlyArray, truncationStatus: { +[threadID: string]: MessageTruncationStatus }, - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, ): MergeNewMessagesResult { const { messageStoreOperations: updateWithLatestThreadInfosOps, @@ -634,7 +634,7 @@ }; function updateMessageStoreWithLatestThreadInfos( messageStore: MessageStore, - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, ): UpdateMessageStoreWithLatestThreadInfosResult { const messageStoreOperations: MessageStoreOperation[] = []; const { @@ -702,7 +702,7 @@ function ensureRealizedThreadIDIsUsedWhenPossible( payload: T, - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, ): T { const pendingToRealizedThreadIDs = pendingToRealizedThreadIDsSelector(threadInfos); @@ -722,7 +722,7 @@ function reduceMessageStore( messageStore: MessageStore, action: BaseAction, - newThreadInfos: MinimallyEncodedRawThreadInfos, + newThreadInfos: RawThreadInfos, ): ReduceMessageStoreResult { if ( action.type === logInActionTypes.success || 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 @@ -43,10 +43,7 @@ fullStateSyncActionType, incrementalStateSyncActionType, } from '../types/socket-types.js'; -import type { - MinimallyEncodedRawThreadInfos, - ThreadStore, -} from '../types/thread-types.js'; +import type { RawThreadInfos, ThreadStore } from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -56,7 +53,7 @@ threadStoreOpsHandlers; function generateOpsForThreadUpdates( - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, payload: { +updatesResult: { +newUpdates: $ReadOnlyArray, ... }, ... 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 @@ -52,7 +52,7 @@ RelativeMemberInfo, ThreadInfo, MixedRawThreadInfos, - MinimallyEncodedRawThreadInfos, + RawThreadInfos, } from '../types/thread-types.js'; import { dateString, dateFromString } from '../utils/date-utils.js'; import { values } from '../utils/objects.js'; @@ -275,7 +275,7 @@ const unreadCount: (state: BaseAppState<>) => number = createSelector( (state: BaseAppState<>) => state.threadStore.threadInfos, - (threadInfos: MinimallyEncodedRawThreadInfos): number => + (threadInfos: RawThreadInfos): number => values(threadInfos).filter( threadInfo => threadInHomeChatList(threadInfo) && threadInfo.currentUser.unread, @@ -284,7 +284,7 @@ const unreadBackgroundCount: (state: BaseAppState<>) => number = createSelector( (state: BaseAppState<>) => state.threadStore.threadInfos, - (threadInfos: MinimallyEncodedRawThreadInfos): number => + (threadInfos: RawThreadInfos): number => values(threadInfos).filter( threadInfo => threadInBackgroundChatList(threadInfo) && threadInfo.currentUser.unread, @@ -296,7 +296,7 @@ ) => (BaseAppState<>) => number = (communityID: string) => createSelector( (state: BaseAppState<>) => state.threadStore.threadInfos, - (threadInfos: MinimallyEncodedRawThreadInfos): number => + (threadInfos: RawThreadInfos): number => Object.values(threadInfos).filter( threadInfo => threadInHomeChatList(threadInfo) && @@ -420,7 +420,7 @@ (state: BaseAppState<>) => state.threadStore.threadInfos, threadInfoSelector, ( - rawThreadInfos: MinimallyEncodedRawThreadInfos, + rawThreadInfos: RawThreadInfos, threadInfos: { +[id: string]: ThreadInfo }, ) => { const pendingToRealizedThreadIDs = @@ -436,10 +436,10 @@ }, ); const pendingToRealizedThreadIDsSelector: ( - rawThreadInfos: MinimallyEncodedRawThreadInfos, + rawThreadInfos: RawThreadInfos, ) => $ReadOnlyMap = createSelector( - (rawThreadInfos: MinimallyEncodedRawThreadInfos) => rawThreadInfos, - (rawThreadInfos: MinimallyEncodedRawThreadInfos) => { + (rawThreadInfos: RawThreadInfos) => rawThreadInfos, + (rawThreadInfos: RawThreadInfos) => { 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 --- a/lib/selectors/user-selectors.js +++ b/lib/selectors/user-selectors.js @@ -16,7 +16,7 @@ import type { LegacyRawThreadInfo, RelativeMemberInfo, - MinimallyEncodedRawThreadInfos, + RawThreadInfos, } from '../types/thread-types.js'; import type { UserInfos, @@ -171,7 +171,7 @@ ) => $ReadOnlySet = createSelector( (state: BaseAppState<>) => state.currentUserInfo && state.currentUserInfo.id, (state: BaseAppState<>) => state.threadStore.threadInfos, - (viewerID: ?string, threadInfos: MinimallyEncodedRawThreadInfos) => { + (viewerID: ?string, threadInfos: RawThreadInfos) => { const personalThreadMembers = new Set(); for (const threadID in threadInfos) { diff --git a/lib/shared/updates/delete-account-spec.js b/lib/shared/updates/delete-account-spec.js --- 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 { MinimallyEncodedRawThreadInfos } from '../../types/thread-types.js'; +import type { RawThreadInfos } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { AccountDeletionRawUpdateInfo, @@ -19,7 +19,7 @@ AccountDeletionUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: MinimallyEncodedRawThreadInfos, + storeThreadInfos: RawThreadInfos, update: AccountDeletionUpdateInfo, ) { const operations = []; diff --git a/lib/shared/updates/join-thread-spec.js b/lib/shared/updates/join-thread-spec.js --- a/lib/shared/updates/join-thread-spec.js +++ b/lib/shared/updates/join-thread-spec.js @@ -18,7 +18,7 @@ messageTruncationStatusValidator, rawMessageInfoValidator, } from '../../types/message-types.js'; -import type { MinimallyEncodedRawThreadInfos } from '../../types/thread-types.js'; +import type { RawThreadInfos } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { ThreadJoinUpdateInfo, @@ -35,7 +35,7 @@ ThreadJoinUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: MinimallyEncodedRawThreadInfos, + storeThreadInfos: RawThreadInfos, update: ThreadJoinUpdateInfo, ) { if (_isEqual(storeThreadInfos[update.threadInfo.id])(update.threadInfo)) { diff --git a/lib/shared/updates/update-spec.js b/lib/shared/updates/update-spec.js --- a/lib/shared/updates/update-spec.js +++ b/lib/shared/updates/update-spec.js @@ -15,7 +15,7 @@ FetchMessageInfosResult, } from '../../types/message-types.js'; import type { - MinimallyEncodedRawThreadInfos, + RawThreadInfos, MixedRawThreadInfos, } from '../../types/thread-types.js'; import type { UpdateType } from '../../types/update-types-enum.js'; @@ -57,7 +57,7 @@ Data: UpdateData, > = { +generateOpsForThreadUpdates?: ( - storeThreadInfos: MinimallyEncodedRawThreadInfos, + storeThreadInfos: RawThreadInfos, 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 --- a/lib/shared/updates/update-thread-read-status-spec.js +++ b/lib/shared/updates/update-thread-read-status-spec.js @@ -3,7 +3,7 @@ import t from 'tcomb'; import type { UpdateSpec } from './update-spec.js'; -import type { MinimallyEncodedRawThreadInfos } from '../../types/thread-types.js'; +import type { RawThreadInfos } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { ThreadReadStatusUpdateInfo, @@ -18,7 +18,7 @@ ThreadReadStatusUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: MinimallyEncodedRawThreadInfos, + storeThreadInfos: RawThreadInfos, update: ThreadReadStatusUpdateInfo, ) { if ( diff --git a/lib/shared/updates/update-thread-spec.js b/lib/shared/updates/update-thread-spec.js --- a/lib/shared/updates/update-thread-spec.js +++ b/lib/shared/updates/update-thread-spec.js @@ -6,7 +6,7 @@ import type { UpdateInfoFromRawInfoParams, UpdateSpec } from './update-spec.js'; import { rawThreadInfoValidator } from '../../permissions/minimally-encoded-thread-permissions-validators.js'; -import type { MinimallyEncodedRawThreadInfos } from '../../types/thread-types.js'; +import type { RawThreadInfos } from '../../types/thread-types.js'; import { updateTypes } from '../../types/update-types-enum.js'; import type { ThreadUpdateInfo, @@ -22,7 +22,7 @@ ThreadUpdateData, > = Object.freeze({ generateOpsForThreadUpdates( - storeThreadInfos: MinimallyEncodedRawThreadInfos, + storeThreadInfos: RawThreadInfos, update: ThreadUpdateInfo, ) { if (_isEqual(storeThreadInfos[update.threadInfo.id])(update.threadInfo)) { diff --git a/lib/types/account-types.js b/lib/types/account-types.js --- a/lib/types/account-types.js +++ b/lib/types/account-types.js @@ -17,7 +17,7 @@ import type { PreRequestUserState } from './session-types.js'; import { type MixedRawThreadInfos, - type MinimallyEncodedRawThreadInfos, + type RawThreadInfos, } from './thread-types.js'; import { type UserInfo, @@ -80,7 +80,7 @@ export type RegisterResult = { +currentUserInfo: LoggedInUserInfo, +rawMessageInfos: $ReadOnlyArray, - +threadInfos: MinimallyEncodedRawThreadInfos, + +threadInfos: RawThreadInfos, +userInfos: $ReadOnlyArray, +calendarQuery: CalendarQuery, }; @@ -157,12 +157,12 @@ ...ServerLogInResponse, +cookieChange: $ReadOnly<{ ...$PropertyType, - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, }>, }>; export type LogInResult = { - +threadInfos: MinimallyEncodedRawThreadInfos, + +threadInfos: RawThreadInfos, +currentUserInfo: LoggedInUserInfo, +messagesResult: GenericMessagesResult, +userInfos: $ReadOnlyArray, diff --git a/lib/types/socket-types.js b/lib/types/socket-types.js --- a/lib/types/socket-types.js +++ b/lib/types/socket-types.js @@ -33,10 +33,7 @@ type ClientClientResponse, } from './request-types.js'; import type { SessionState, SessionIdentification } from './session-types.js'; -import type { - MixedRawThreadInfos, - MinimallyEncodedRawThreadInfos, -} from './thread-types.js'; +import type { MixedRawThreadInfos, RawThreadInfos } from './thread-types.js'; import { type ClientUpdatesResult, type ClientUpdatesResultWithUserInfos, @@ -200,7 +197,7 @@ export type ClientFullStateSync = $ReadOnly<{ ...BaseFullStateSync, - +threadInfos: MinimallyEncodedRawThreadInfos, + +threadInfos: RawThreadInfos, +currentUserInfo: CurrentUserInfo, }>; export type StateSyncFullActionPayload = $ReadOnly<{ 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 @@ -147,7 +147,7 @@ export type MixedRawThreadInfos = { +[id: string]: LegacyRawThreadInfo | RawThreadInfo, }; -export type MinimallyEncodedRawThreadInfos = { +export type RawThreadInfos = { +[id: string]: RawThreadInfo, }; @@ -250,7 +250,7 @@ }; export type ThreadStore = { - +threadInfos: MinimallyEncodedRawThreadInfos, + +threadInfos: RawThreadInfos, }; export type ClientDBThreadInfo = { diff --git a/native/selectors/message-selectors.js b/native/selectors/message-selectors.js --- a/native/selectors/message-selectors.js +++ b/native/selectors/message-selectors.js @@ -6,7 +6,7 @@ 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 { MinimallyEncodedRawThreadInfos } from 'lib/types/thread-types.js'; +import type { RawThreadInfos } 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 @@ (state: AppState) => state.threadStore.threadInfos, (state: AppState) => state.threadActivityStore, ( - threadInfos: MinimallyEncodedRawThreadInfos, + threadInfos: RawThreadInfos, threadActivityStore: ThreadActivityStore, ): ?number => { let nextTime; diff --git a/web/redux/nav-reducer.js b/web/redux/nav-reducer.js --- 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 { MinimallyEncodedRawThreadInfos } from 'lib/types/thread-types.js'; +import type { RawThreadInfos } 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 @@ export default function reduceNavInfo( oldState: NavInfo, action: Action, - newThreadInfos: MinimallyEncodedRawThreadInfos, + newThreadInfos: RawThreadInfos, ): NavInfo { let state = oldState; if (action.type === updateNavInfoActionType) { diff --git a/web/selectors/thread-selectors.js b/web/selectors/thread-selectors.js --- a/web/selectors/thread-selectors.js +++ b/web/selectors/thread-selectors.js @@ -15,10 +15,7 @@ ComposableMessageInfo, RobotextMessageInfo, } from 'lib/types/message-types.js'; -import type { - MinimallyEncodedRawThreadInfos, - ThreadInfo, -} from 'lib/types/thread-types.js'; +import type { RawThreadInfos, ThreadInfo } from 'lib/types/thread-types.js'; import { values } from 'lib/utils/objects.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; @@ -143,10 +140,7 @@ createSelector( (state: AppState) => state.threadStore.threadInfos, (state: AppState) => state.communityPickerStore.chat, - ( - threadInfos: MinimallyEncodedRawThreadInfos, - communityID: ?string, - ): number => + (threadInfos: RawThreadInfos, communityID: ?string): number => values(threadInfos).filter( threadInfo => threadInHomeChatList(threadInfo) &&