Page MenuHomePhabricator

D10077.diff
No OneTemporary

D10077.diff

diff --git a/keyserver/src/creators/update-creator.js b/keyserver/src/creators/update-creator.js
--- a/keyserver/src/creators/update-creator.js
+++ b/keyserver/src/creators/update-creator.js
@@ -31,7 +31,7 @@
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 @@
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
--- a/keyserver/src/fetchers/thread-fetchers.js
+++ b/keyserver/src/fetchers/thread-fetchers.js
@@ -14,9 +14,9 @@
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 @@
}
export type FetchThreadInfosResult = {
- +threadInfos: RawThreadInfos,
+ +threadInfos: LegacyRawThreadInfos,
};
async function fetchThreadInfos(
@@ -278,7 +278,7 @@
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
--- a/keyserver/src/responders/thread-responders.js
+++ b/keyserver/src/responders/thread-responders.js
@@ -30,7 +30,7 @@
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 roleModificationResultValidator: TInterface<RoleModificationResult> =
tShape<RoleModificationResult>({
- threadInfo: t.maybe(rawThreadInfoValidator),
+ threadInfo: t.maybe(legacyRawThreadInfoValidator),
updatesResult: tShape({
newUpdates: t.list(serverUpdateInfoValidator),
}),
@@ -310,7 +310,7 @@
export const roleDeletionResultValidator: TInterface<RoleDeletionResult> =
tShape<RoleDeletionResult>({
- 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
--- a/keyserver/src/responders/user-responders.js
+++ b/keyserver/src/responders/user-responders.js
@@ -61,7 +61,7 @@
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 @@
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 @@
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<TEnums>(policyTypeValidator)),
diff --git a/keyserver/src/scripts/generate-converter-from-validator.js b/keyserver/src/scripts/generate-converter-from-validator.js
--- a/keyserver/src/scripts/generate-converter-from-validator.js
+++ b/keyserver/src/scripts/generate-converter-from-validator.js
@@ -7,7 +7,7 @@
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 @@
}
// 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
--- 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 { validateOutput } from '../../utils/validation-utils.js';
export const threadsStateSyncSpec: ServerStateSyncSpec<
- RawThreadInfos,
- RawThreadInfos,
- RawThreadInfo,
+ LegacyRawThreadInfos,
+ LegacyRawThreadInfos,
+ LegacyRawThreadInfo,
$ReadOnlyArray<ClientThreadInconsistencyReportCreationRequest>,
> = Object.freeze({
fetch,
@@ -40,10 +40,10 @@
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
--- a/keyserver/src/socket/socket.js
+++ b/keyserver/src/socket/socket.js
@@ -41,7 +41,7 @@
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 @@
);
// We have a type error here because Flow doesn't know spec.hashKey
const castPromises: {
- +threadInfos: Promise<RawThreadInfos>,
+ +threadInfos: Promise<LegacyRawThreadInfos>,
+currentUserInfo: Promise<CurrentUserInfo>,
+entryInfos: Promise<$ReadOnlyArray<RawEntryInfo>>,
+userInfos: Promise<$ReadOnlyArray<UserInfo>>,
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
@@ -38,7 +38,7 @@
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 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
--- a/lib/hooks/child-threads.js
+++ b/lib/hooks/child-threads.js
@@ -18,7 +18,7 @@
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 @@
(
thread: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo
),
diff --git a/lib/hooks/search-threads.js b/lib/hooks/search-threads.js
--- a/lib/hooks/search-threads.js
+++ b/lib/hooks/search-threads.js
@@ -17,7 +17,7 @@
import type {
SidebarInfo,
ThreadInfo,
- RawThreadInfo,
+ LegacyRawThreadInfo,
} from '../types/thread-types.js';
import { useSelector } from '../utils/redux-utils.js';
@@ -110,7 +110,7 @@
(
thread: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo
),
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
@@ -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 ReplaceThreadOperation = {
+type: 'replace',
- +payload: { +id: string, +threadInfo: RawThreadInfo },
+ +payload: { +id: string, +threadInfo: LegacyRawThreadInfo },
};
export type ThreadStoreOperation =
@@ -45,7 +45,7 @@
ThreadStore,
ThreadStoreOperation,
ClientDBThreadStoreOperation,
- RawThreadInfos,
+ LegacyRawThreadInfos,
ClientDBThreadInfo,
> = {
processStoreOperations(
@@ -87,7 +87,7 @@
},
translateClientDBData(data: $ReadOnlyArray<ClientDBThreadInfo>): {
- +[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
--- 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 @@
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
--- a/lib/permissions/minimally-encoded-thread-permissions-validators.js
+++ b/lib/permissions/minimally-encoded-thread-permissions-validators.js
@@ -16,7 +16,7 @@
} from '../types/minimally-encoded-thread-permissions-types.js';
import {
legacyMemberInfoValidator,
- rawThreadInfoValidator,
+ legacyRawThreadInfoValidator,
legacyRoleInfoValidator,
threadCurrentUserInfoValidator,
threadInfoValidator,
@@ -68,7 +68,7 @@
const minimallyEncodedRawThreadInfoValidator: TInterface<MinimallyEncodedRawThreadInfo> =
tShape<MinimallyEncodedRawThreadInfo>({
- ...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
--- a/lib/reducers/calendar-filters-reducer.js
+++ b/lib/reducers/calendar-filters-reducer.js
@@ -37,7 +37,10 @@
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 removeDeletedThreadIDsFromFilterList(
state: $ReadOnlyArray<CalendarFilter>,
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
): $ReadOnlyArray<CalendarFilter> {
const currentlyFilteredIDs = filteredThreadIDs(state);
if (!currentlyFilteredIDs) {
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
@@ -54,7 +54,7 @@
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 @@
currentEntryInfos: { +[id: string]: RawEntryInfo },
currentDaysToEntries: ?{ +[day: string]: string[] },
newEntryInfos: $ReadOnlyArray<RawEntryInfo>,
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
) {
const mergedEntryInfos: { [string]: RawEntryInfo } = {};
let someEntryUpdated = false;
@@ -163,7 +163,7 @@
function reduceEntryInfos(
entryStore: EntryStore,
action: BaseAction,
- newThreadInfos: RawThreadInfos,
+ newThreadInfos: LegacyRawThreadInfos,
): [EntryStore, $ReadOnlyArray<ClientEntryInconsistencyReportCreationRequest>] {
const { entryInfos, daysToEntries, lastUserInteractionCalendar } = entryStore;
if (
diff --git a/lib/reducers/integrity-reducer.js b/lib/reducers/integrity-reducer.js
--- a/lib/reducers/integrity-reducer.js
+++ b/lib/reducers/integrity-reducer.js
@@ -11,13 +11,13 @@
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<ThreadStoreOperation>,
): IntegrityStore {
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
@@ -94,7 +94,10 @@
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 isThreadWatched(
threadID: string,
- threadInfo: ?RawThreadInfo,
+ threadInfo: ?LegacyRawThreadInfo,
watchedIDs: $ReadOnlyArray<string>,
) {
return (
@@ -146,7 +149,7 @@
messageInfos: $ReadOnlyArray<RawMessageInfo>,
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 @@
function reassignMessagesToRealizedThreads(
messageStore: MessageStore,
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
): ReassignmentResult {
const pendingToRealizedThreadIDs =
pendingToRealizedThreadIDsSelector(threadInfos);
@@ -305,7 +308,7 @@
oldMessageStore: MessageStore,
newMessageInfos: $ReadOnlyArray<RawMessageInfo>,
truncationStatus: { +[threadID: string]: MessageTruncationStatus },
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
): MergeNewMessagesResult {
const {
messageStoreOperations: updateWithLatestThreadInfosOps,
@@ -629,7 +632,7 @@
};
function updateMessageStoreWithLatestThreadInfos(
messageStore: MessageStore,
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
): UpdateMessageStoreWithLatestThreadInfosResult {
const messageStoreOperations: MessageStoreOperation[] = [];
const {
@@ -697,7 +700,7 @@
function ensureRealizedThreadIDIsUsedWhenPossible<T: RawMessageInfo>(
payload: T,
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
): T {
const pendingToRealizedThreadIDs =
pendingToRealizedThreadIDsSelector(threadInfos);
@@ -717,7 +720,7 @@
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
--- a/lib/reducers/thread-reducer.js
+++ b/lib/reducers/thread-reducer.js
@@ -42,8 +42,8 @@
incrementalStateSyncActionType,
} from '../types/socket-types.js';
import type {
- RawThreadInfo,
- RawThreadInfos,
+ LegacyRawThreadInfo,
+ LegacyRawThreadInfos,
ThreadStore,
} from '../types/thread-types.js';
import {
@@ -56,7 +56,7 @@
threadStoreOpsHandlers;
function generateOpsForThreadUpdates(
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
payload: {
+updatesResult: { +newUpdates: $ReadOnlyArray<ClientUpdateInfo>, ... },
...
@@ -202,7 +202,7 @@
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 @@
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
--- a/lib/selectors/chat-selectors.js
+++ b/lib/selectors/chat-selectors.js
@@ -43,7 +43,7 @@
import { threadTypes } from '../types/thread-types-enum.js';
import {
type ThreadInfo,
- type RawThreadInfo,
+ type LegacyRawThreadInfo,
type SidebarInfo,
maxReadSidebars,
maxUnreadSidebars,
@@ -234,7 +234,7 @@
filterFunction: (
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo
),
@@ -266,7 +266,7 @@
filterFunction: (
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo
),
diff --git a/lib/selectors/nav-selectors.js b/lib/selectors/nav-selectors.js
--- a/lib/selectors/nav-selectors.js
+++ b/lib/selectors/nav-selectors.js
@@ -18,7 +18,7 @@
} 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 @@
function useThreadSearchIndex(
threadInfos: $ReadOnlyArray<
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
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
@@ -49,9 +49,9 @@
} 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 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 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 @@
(state: BaseAppState<>) => state.threadStore.threadInfos[threadID],
relativeMemberInfoSelectorForMembersOfThread(threadID),
(
- threadInfo: ?RawThreadInfo,
+ threadInfo: ?LegacyRawThreadInfo,
members: $ReadOnlyArray<RelativeMemberInfo>,
): boolean => {
if (!threadInfo) {
@@ -357,7 +357,7 @@
function mostRecentlyReadThread(
messageStore: MessageStore,
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
): ?string {
let mostRecent = null;
for (const threadID in threadInfos) {
@@ -399,7 +399,7 @@
(state: BaseAppState<>) => state.threadStore.threadInfos,
threadInfoSelector,
(
- rawThreadInfos: RawThreadInfos,
+ rawThreadInfos: LegacyRawThreadInfos,
threadInfos: { +[id: string]: ThreadInfo },
) => {
const pendingToRealizedThreadIDs =
@@ -415,10 +415,10 @@
},
);
const pendingToRealizedThreadIDsSelector: (
- rawThreadInfos: RawThreadInfos,
+ rawThreadInfos: LegacyRawThreadInfos,
) => $ReadOnlyMap<string, string> = createSelector(
- (rawThreadInfos: RawThreadInfos) => rawThreadInfos,
- (rawThreadInfos: RawThreadInfos) => {
+ (rawThreadInfos: LegacyRawThreadInfos) => rawThreadInfos,
+ (rawThreadInfos: LegacyRawThreadInfos) => {
const result = new Map<string, string>();
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
@@ -15,9 +15,9 @@
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 getRelativeMemberInfos(
- threadInfo: ?RawThreadInfo,
+ threadInfo: ?LegacyRawThreadInfo,
currentUserID: ?string,
userInfos: UserInfos,
): $ReadOnlyArray<LegacyRelativeMemberInfo> {
@@ -210,7 +210,7 @@
) => $ReadOnlySet<string> = 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<string>();
for (const threadID in threadInfos) {
diff --git a/lib/shared/avatar-utils.js b/lib/shared/avatar-utils.js
--- a/lib/shared/avatar-utils.js
+++ b/lib/shared/avatar-utils.js
@@ -21,7 +21,10 @@
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 getUserAvatarForThread(
threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -305,7 +308,7 @@
function getAvatarForThread(
thread:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo,
@@ -326,7 +329,7 @@
function useAvatarForThread(
thread:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js
--- a/lib/shared/message-utils.js
+++ b/lib/shared/message-utils.js
@@ -45,7 +45,7 @@
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 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
--- a/lib/shared/state-sync/threads-state-sync-spec.js
+++ b/lib/shared/state-sync/threads-state-sync-spec.js
@@ -11,8 +11,8 @@
} 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 @@
const selector: (
state: AppState,
) => BoundStateSyncSpec<
- RawThreadInfos,
- RawThreadInfo,
+ LegacyRawThreadInfos,
+ LegacyRawThreadInfo,
$ReadOnlyArray<ClientThreadInconsistencyReportCreationRequest>,
> = createSelector(
(state: AppState) => state.integrityStore.threadHashes,
@@ -43,8 +43,8 @@
);
export const threadsStateSyncSpec: StateSyncSpec<
- RawThreadInfos,
- RawThreadInfo,
+ LegacyRawThreadInfos,
+ LegacyRawThreadInfo,
$ReadOnlyArray<ClientThreadInconsistencyReportCreationRequest>,
> = Object.freeze({
hashKey: 'threadInfos',
@@ -55,8 +55,8 @@
},
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
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -80,7 +80,7 @@
assertThreadType,
} from '../types/thread-types-enum.js';
import {
- type RawThreadInfo,
+ type LegacyRawThreadInfo,
type ThreadInfo,
type MemberInfo,
type ServerThreadInfo,
@@ -123,7 +123,7 @@
function threadHasPermission(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -146,7 +146,7 @@
function viewerIsMember(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -161,7 +161,7 @@
function threadIsInHome(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -173,7 +173,7 @@
function threadInChatList(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -187,7 +187,7 @@
function threadIsTopLevel(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -198,7 +198,7 @@
function threadIsChannel(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -209,7 +209,7 @@
function threadIsSidebar(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -220,7 +220,7 @@
function threadInBackgroundChatList(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -231,7 +231,7 @@
function threadInHomeChatList(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -244,7 +244,7 @@
function threadInFilterList(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -259,7 +259,7 @@
function userIsMember(
threadInfo: ?(
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo
),
@@ -294,7 +294,7 @@
function threadMembersWithoutAddedAshoat<
T:
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
>(threadInfo: T): $PropertyType<T, 'members'> {
@@ -314,7 +314,7 @@
function threadOrParentThreadIsGroupChat(
threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -333,7 +333,7 @@
function getSingleOtherUser(
threadInfo:
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
viewerID: ?string,
@@ -815,7 +815,7 @@
serverThreadInfo: ServerThreadInfo,
viewerID: string,
options?: RawThreadInfoOptions,
-): ?RawThreadInfo {
+): ?LegacyRawThreadInfo {
const filterThreadEditAvatarPermission =
options?.filterThreadEditAvatarPermission;
const excludePinInfo = options?.excludePinInfo;
@@ -967,7 +967,7 @@
}
function threadInfoFromRawThreadInfo(
- rawThreadInfo: RawThreadInfo,
+ rawThreadInfo: LegacyRawThreadInfo,
viewerID: ?string,
userInfos: UserInfos,
): ThreadInfo {
@@ -1016,7 +1016,7 @@
}
function getCurrentUser(
- threadInfo: RawThreadInfo | ThreadInfo,
+ threadInfo: LegacyRawThreadInfo | ThreadInfo,
viewerID: ?string,
userInfos: UserInfos,
): ThreadCurrentUserInfo {
@@ -1057,7 +1057,7 @@
function threadIsWithBlockedUserOnly(
threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1093,7 +1093,7 @@
function threadFrozenDueToBlock(
threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1105,7 +1105,7 @@
function threadFrozenDueToViewerBlock(
threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1126,7 +1126,7 @@
memberInfo: RelativeMemberInfo | MemberInfo,
threadInfo:
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
): boolean {
@@ -1152,7 +1152,7 @@
function threadHasAdminRole(
threadInfo: ?(
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| ServerThreadInfo
| MinimallyEncodedRawThreadInfo
@@ -1167,7 +1167,7 @@
function threadOrParentThreadHasAdminRole(
threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1422,7 +1422,7 @@
function threadMemberHasPermission(
threadInfo:
| ServerThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1508,7 +1508,7 @@
function getContainingThreadID(
parentThreadInfo:
| ?ServerThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1529,7 +1529,7 @@
function getCommunity(
parentThreadInfo:
| ?ServerThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1756,7 +1756,7 @@
function threadInfoInsideCommunity(
threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1838,7 +1838,7 @@
function communityOrThreadNoun(
threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
@@ -1850,7 +1850,7 @@
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
--- 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 @@
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
--- 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 @@
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
--- a/lib/shared/updates/join-thread-spec.js
+++ b/lib/shared/updates/join-thread-spec.js
@@ -18,8 +18,8 @@
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 @@
ThreadJoinUpdateData,
> = Object.freeze({
generateOpsForThreadUpdates(
- storeThreadInfos: RawThreadInfos,
+ storeThreadInfos: LegacyRawThreadInfos,
update: ThreadJoinUpdateInfo,
) {
if (_isEqual(storeThreadInfos[update.threadInfo.id])(update.threadInfo)) {
@@ -171,7 +171,7 @@
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
--- a/lib/shared/updates/update-spec.js
+++ b/lib/shared/updates/update-spec.js
@@ -14,7 +14,7 @@
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 @@
} from '../../types/user-types.js';
export type UpdateInfosRawData = {
- +threadInfos: RawThreadInfos,
+ +threadInfos: LegacyRawThreadInfos,
+messageInfosResult: ?FetchMessageInfosResult,
+calendarResult: ?FetchEntryInfosBase,
+entryInfosResult: ?RawEntryInfos,
@@ -54,7 +54,7 @@
Data: UpdateData,
> = {
+generateOpsForThreadUpdates?: (
- storeThreadInfos: RawThreadInfos,
+ storeThreadInfos: LegacyRawThreadInfos,
update: UpdateInfo,
) => ?$ReadOnlyArray<ThreadStoreOperation>,
+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
@@ -4,8 +4,8 @@
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 @@
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
--- a/lib/shared/updates/update-thread-spec.js
+++ b/lib/shared/updates/update-thread-spec.js
@@ -5,8 +5,8 @@
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 @@
ThreadUpdateData,
> = Object.freeze({
generateOpsForThreadUpdates(
- storeThreadInfos: RawThreadInfos,
+ storeThreadInfos: LegacyRawThreadInfos,
update: ThreadUpdateInfo,
) {
if (_isEqual(storeThreadInfos[update.threadInfo.id])(update.threadInfo)) {
@@ -114,6 +114,6 @@
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
--- a/lib/shared/user-utils.js
+++ b/lib/shared/user-utils.js
@@ -7,7 +7,7 @@
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 useKeyserverAdmin(
community:
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ServerThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo,
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
@@ -15,7 +15,7 @@
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 @@
rawMessageInfos: $ReadOnlyArray<RawMessageInfo>,
currentUserInfo: LoggedInUserInfo,
cookieChange: {
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
userInfos: $ReadOnlyArray<UserInfo>,
},
};
@@ -77,7 +77,7 @@
export type RegisterResult = {
+currentUserInfo: LoggedInUserInfo,
+rawMessageInfos: $ReadOnlyArray<RawMessageInfo>,
- +threadInfos: RawThreadInfos,
+ +threadInfos: LegacyRawThreadInfos,
+userInfos: $ReadOnlyArray<UserInfo>,
+calendarQuery: CalendarQuery,
};
@@ -142,14 +142,14 @@
+rawEntryInfos?: ?$ReadOnlyArray<RawEntryInfo>,
+serverTime: number,
+cookieChange: {
- +threadInfos: RawThreadInfos,
+ +threadInfos: LegacyRawThreadInfos,
+userInfos: $ReadOnlyArray<UserInfo>,
},
+notAcknowledgedPolicies?: $ReadOnlyArray<PolicyType>,
};
export type LogInResult = {
- +threadInfos: RawThreadInfos,
+ +threadInfos: LegacyRawThreadInfos,
+currentUserInfo: LoggedInUserInfo,
+messagesResult: GenericMessagesResult,
+userInfos: $ReadOnlyArray<UserInfo>,
diff --git a/lib/types/minimally-encoded-thread-permissions-types.js b/lib/types/minimally-encoded-thread-permissions-types.js
--- a/lib/types/minimally-encoded-thread-permissions-types.js
+++ b/lib/types/minimally-encoded-thread-permissions-types.js
@@ -4,7 +4,7 @@
import type {
LegacyMemberInfo,
- RawThreadInfo,
+ LegacyRawThreadInfo,
LegacyRelativeMemberInfo,
LegacyRoleInfo,
ThreadCurrentUserInfo,
@@ -122,7 +122,7 @@
};
export type MinimallyEncodedRawThreadInfo = $ReadOnly<{
- ...RawThreadInfo,
+ ...LegacyRawThreadInfo,
+minimallyEncoded: true,
+members: $ReadOnlyArray<MinimallyEncodedMemberInfo>,
+roles: { +[id: string]: MinimallyEncodedRoleInfo },
@@ -130,7 +130,7 @@
}>;
const minimallyEncodeRawThreadInfo = (
- rawThreadInfo: RawThreadInfo,
+ rawThreadInfo: LegacyRawThreadInfo,
): MinimallyEncodedRawThreadInfo => {
const { members, roles, currentUser, ...rest } = rawThreadInfo;
return {
@@ -144,7 +144,7 @@
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
--- a/lib/types/report-types.js
+++ b/lib/types/report-types.js
@@ -7,7 +7,7 @@
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 ThreadInconsistencyReportShape = {
+platformDetails: PlatformDetails,
- +beforeAction: RawThreadInfos,
+ +beforeAction: LegacyRawThreadInfos,
+action: BaseAction,
- +pollResult?: ?RawThreadInfos,
- +pushResult: RawThreadInfos,
+ +pollResult?: ?LegacyRawThreadInfos,
+ +pushResult: LegacyRawThreadInfos,
+lastActionTypes?: ?$ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,
+lastActions?: ?$ReadOnlyArray<ActionSummary>,
+time?: ?number,
@@ -139,9 +139,9 @@
export type ClientThreadInconsistencyReportShape = {
+platformDetails: PlatformDetails,
- +beforeAction: RawThreadInfos,
+ +beforeAction: LegacyRawThreadInfos,
+action: BaseAction,
- +pushResult: RawThreadInfos,
+ +pushResult: LegacyRawThreadInfos,
+lastActions: $ReadOnlyArray<ActionSummary>,
+time: number,
};
diff --git a/lib/types/request-types.js b/lib/types/request-types.js
--- a/lib/types/request-types.js
+++ b/lib/types/request-types.js
@@ -18,7 +18,10 @@
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 StateChanges = Partial<{
- +rawThreadInfos: RawThreadInfo[],
+ +rawThreadInfos: LegacyRawThreadInfo[],
+rawEntryInfos: RawEntryInfo[],
+currentUserInfo: CurrentUserInfo,
+userInfos: AccountUserInfo[],
@@ -130,7 +133,7 @@
),
stateChanges: t.maybe(
tShape<StateChanges>({
- 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 @@
+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
--- a/lib/types/session-types.js
+++ b/lib/types/session-types.js
@@ -4,7 +4,7 @@
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 ServerSessionChange =
| {
cookieInvalidated: false,
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
userInfos: $ReadOnlyArray<UserInfo>,
sessionID?: null | string,
cookie?: string,
}
| {
cookieInvalidated: true,
- threadInfos: RawThreadInfos,
+ threadInfos: LegacyRawThreadInfos,
userInfos: $ReadOnlyArray<UserInfo>,
currentUserInfo: LoggedOutUserInfo,
sessionID?: null | string,
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,7 +33,10 @@
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 fullStateSyncActionType = 'FULL_STATE_SYNC';
export type BaseFullStateSync = {
+messagesResult: MessagesResponse,
- +threadInfos: RawThreadInfos,
+ +threadInfos: LegacyRawThreadInfos,
+rawEntryInfos: $ReadOnlyArray<RawEntryInfo>,
+userInfos: $ReadOnlyArray<UserInfo>,
+updatesCurrentAsOf: number,
};
const baseFullStateSyncValidator = tShape<BaseFullStateSync>({
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
--- a/lib/types/thread-types.js
+++ b/lib/types/thread-types.js
@@ -101,7 +101,7 @@
unread: t.maybe(t.Boolean),
});
-export type RawThreadInfo = {
+export type LegacyRawThreadInfo = {
+id: string,
+type: ThreadType,
+name: ?string,
@@ -119,11 +119,11 @@
+repliesCount: number,
+pinnedCount?: number,
};
-export type RawThreadInfos = {
- +[id: string]: RawThreadInfo,
+export type LegacyRawThreadInfos = {
+ +[id: string]: LegacyRawThreadInfo,
};
-export const rawThreadInfoValidator: TInterface<RawThreadInfo> =
- tShape<RawThreadInfo>({
+export const legacyRawThreadInfoValidator: TInterface<LegacyRawThreadInfo> =
+ tShape<LegacyRawThreadInfo>({
id: tID,
type: threadTypeValidator,
name: t.maybe(t.String),
@@ -230,11 +230,11 @@
};
export type ThreadStore = {
- +threadInfos: RawThreadInfos,
+ +threadInfos: LegacyRawThreadInfos,
};
export const threadStoreValidator: TInterface<ThreadStore> =
tShape<ThreadStore>({
- threadInfos: t.dict(tID, rawThreadInfoValidator),
+ threadInfos: t.dict(tID, legacyRawThreadInfoValidator),
});
export type ClientDBThreadInfo = {
@@ -434,14 +434,14 @@
export type RoleModificationRequest = CreateRoleAction | EditRoleAction;
export type RoleModificationResult = {
- +threadInfo: RawThreadInfo,
+ +threadInfo: LegacyRawThreadInfo,
+updatesResult: {
+newUpdates: $ReadOnlyArray<ServerUpdateInfo>,
},
};
export type RoleModificationPayload = {
- +threadInfo: RawThreadInfo,
+ +threadInfo: LegacyRawThreadInfo,
+updatesResult: {
+newUpdates: $ReadOnlyArray<ClientUpdateInfo>,
},
@@ -453,14 +453,14 @@
};
export type RoleDeletionResult = {
- +threadInfo: RawThreadInfo,
+ +threadInfo: LegacyRawThreadInfo,
+updatesResult: {
+newUpdates: $ReadOnlyArray<ServerUpdateInfo>,
},
};
export type RoleDeletionPayload = {
- +threadInfo: RawThreadInfo,
+ +threadInfo: LegacyRawThreadInfo,
+updatesResult: {
+newUpdates: $ReadOnlyArray<ClientUpdateInfo>,
},
@@ -474,7 +474,7 @@
// 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
--- a/lib/types/update-types.js
+++ b/lib/types/update-types.js
@@ -7,7 +7,7 @@
type RawMessageInfo,
type MessageTruncationStatus,
} from './message-types.js';
-import { type RawThreadInfo } from './thread-types.js';
+import { type LegacyRawThreadInfo } from './thread-types.js';
import {
type UserInfo,
userInfoValidator,
@@ -183,7 +183,7 @@
+type: 1,
+id: string,
+time: number,
- +threadInfo: RawThreadInfo,
+ +threadInfo: LegacyRawThreadInfo,
};
export type ThreadReadStatusUpdateInfo = {
@@ -205,7 +205,7 @@
+type: 4,
+id: string,
+time: number,
- +threadInfo: RawThreadInfo,
+ +threadInfo: LegacyRawThreadInfo,
+rawMessageInfos: $ReadOnlyArray<RawMessageInfo>,
+truncationStatus: MessageTruncationStatus,
+rawEntryInfos: $ReadOnlyArray<RawEntryInfo>,
diff --git a/lib/types/validation.test.js b/lib/types/validation.test.js
--- a/lib/types/validation.test.js
+++ b/lib/types/validation.test.js
@@ -22,7 +22,7 @@
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 @@
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
--- a/lib/utils/drawer-utils.react.js
+++ b/lib/utils/drawer-utils.react.js
@@ -9,7 +9,7 @@
} 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 @@
threadInfosObj: {
+[id: string]:
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo,
},
diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js
--- a/lib/utils/entity-text.js
+++ b/lib/utils/entity-text.js
@@ -18,7 +18,10 @@
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 @@
+display?: 'shortName',
+threadInfo:
| ThreadInfo
- | RawThreadInfo
+ | LegacyRawThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo,
+subchannel?: ?boolean,
@@ -154,7 +157,7 @@
+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
--- 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 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
--- a/lib/utils/thread-ops-utils.test.js
+++ b/lib/utils/thread-ops-utils.test.js
@@ -6,10 +6,10 @@
} 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 @@
});
});
-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
--- a/lib/utils/toggle-pin-utils.js
+++ b/lib/utils/toggle-pin-utils.js
@@ -8,12 +8,12 @@
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
--- a/native/avatars/edit-thread-avatar.react.js
+++ b/native/avatars/edit-thread-avatar.react.js
@@ -10,7 +10,10 @@
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 @@
type Props = {
+threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedThreadInfo
| MinimallyEncodedRawThreadInfo,
diff --git a/native/avatars/thread-avatar.react.js b/native/avatars/thread-avatar.react.js
--- a/native/avatars/thread-avatar.react.js
+++ b/native/avatars/thread-avatar.react.js
@@ -15,7 +15,7 @@
} 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 @@
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
--- a/native/chat/settings/emoji-thread-avatar-creation.react.js
+++ b/native/chat/settings/emoji-thread-avatar-creation.react.js
@@ -10,7 +10,10 @@
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 @@
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
--- a/native/redux/client-db-utils.js
+++ b/native/redux/client-db-utils.js
@@ -9,7 +9,7 @@
} from 'lib/types/message-types.js';
import type {
ClientDBThreadInfo,
- RawThreadInfo,
+ LegacyRawThreadInfo,
ThreadStoreThreadInfos,
} from 'lib/types/thread-types.js';
import {
@@ -71,7 +71,10 @@
// 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 @@
migrationFunc(threadIDToThreadInfo);
// Convert the updated `threadInfo`s back into an array.
- const updatedRawThreadInfos: $ReadOnlyArray<RawThreadInfo> = values(
+ const updatedRawThreadInfos: $ReadOnlyArray<LegacyRawThreadInfo> = values(
updatedThreadIDToThreadInfo,
);
diff --git a/native/redux/edit-thread-permission-migration.js b/native/redux/edit-thread-permission-migration.js
--- a/native/redux/edit-thread-permission-migration.js
+++ b/native/redux/edit-thread-permission-migration.js
@@ -4,14 +4,14 @@
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 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
--- 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 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
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -72,7 +72,7 @@
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 @@
},
}),
[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 @@
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 @@
// 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 @@
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
--- 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 @@
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
--- 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 @@
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
--- a/native/redux/update-roles-and-permissions.js
+++ b/native/redux/update-roles-and-permissions.js
@@ -8,7 +8,7 @@
} 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 @@
const recursivelyUpdateRoles = (
node: $ReadOnly<ThreadTraversalNode>,
): 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 @@
node: $ReadOnly<ThreadTraversalNode>,
memberToThreadPermissionsFromParent: ?MemberToThreadPermissionsFromParent,
): void => {
- const threadInfo: RawThreadInfo = updatedThreadStoreInfos[node.threadID];
+ const threadInfo: LegacyRawThreadInfo =
+ updatedThreadStoreInfos[node.threadID];
const updatedMembers = [];
const memberToThreadPermissionsForChildren: {
@@ -123,7 +125,8 @@
node: $ReadOnly<ThreadTraversalNode>,
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
--- 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 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 @@
(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
--- a/web/avatars/edit-thread-avatar-menu.react.js
+++ b/web/avatars/edit-thread-avatar-menu.react.js
@@ -10,7 +10,10 @@
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 @@
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
--- a/web/avatars/edit-thread-avatar.react.js
+++ b/web/avatars/edit-thread-avatar.react.js
@@ -10,7 +10,10 @@
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 @@
type Props = {
+threadInfo:
- | RawThreadInfo
+ | LegacyRawThreadInfo
| ThreadInfo
| MinimallyEncodedRawThreadInfo
| MinimallyEncodedThreadInfo,
diff --git a/web/avatars/thread-avatar.react.js b/web/avatars/thread-avatar.react.js
--- a/web/avatars/thread-avatar.react.js
+++ b/web/avatars/thread-avatar.react.js
@@ -13,14 +13,17 @@
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
--- a/web/avatars/thread-emoji-avatar-selection-modal.react.js
+++ b/web/avatars/thread-emoji-avatar-selection-modal.react.js
@@ -16,14 +16,17 @@
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
--- a/web/redux/initial-state-gate.js
+++ b/web/redux/initial-state-gate.js
@@ -8,7 +8,7 @@
import type { ThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
import { allUpdatesCurrentAsOfSelector } from 'lib/selectors/keyserver-selectors.js';
import { canUseDatabaseOnWeb } from 'lib/shared/web-database.js';
-import type { 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 @@
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
--- 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 @@
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
--- a/web/selectors/thread-selectors.js
+++ b/web/selectors/thread-selectors.js
@@ -16,7 +16,10 @@
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 @@
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) &&

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 11:31 AM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2584426
Default Alt Text
D10077.diff (76 KB)

Event Timeline