Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3159377
D10281.id34609.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10281.id34609.diff
View Options
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
@@ -82,21 +82,22 @@
threadTypeIsCommunityRoot,
assertThreadType,
} from '../types/thread-types-enum.js';
-import {
- type LegacyRawThreadInfo,
- type LegacyThreadInfo,
- type MemberInfo,
- type ServerThreadInfo,
- type ThreadCurrentUserInfo,
- type RoleInfo,
- type ServerMemberInfo,
- type ClientNewThreadRequest,
- type NewThreadResult,
- type ChangeThreadSettingsPayload,
- type UserProfileThreadInfo,
- type RelativeMemberInfo,
- type RawThreadInfo,
- type ThreadInfo,
+import type {
+ LegacyRawThreadInfo,
+ LegacyThreadInfo,
+ MemberInfo,
+ ServerThreadInfo,
+ ThreadCurrentUserInfo,
+ RoleInfo,
+ ServerMemberInfo,
+ ClientNewThreadRequest,
+ NewThreadResult,
+ ChangeThreadSettingsPayload,
+ UserProfileThreadInfo,
+ RelativeMemberInfo,
+ RawThreadInfo,
+ ThreadInfo,
+ RawThreadInfos,
} from '../types/thread-types.js';
import { updateTypes } from '../types/update-types-enum.js';
import { type ClientUpdateInfo } from '../types/update-types.js';
@@ -1756,6 +1757,20 @@
]);
}
+function assertAllThreadInfosAreLegacy(rawThreadInfos: RawThreadInfos): {
+ [id: string]: LegacyRawThreadInfo,
+} {
+ return Object.fromEntries(
+ Object.entries(rawThreadInfos).map(([id, rawThreadInfo]) => {
+ invariant(
+ !rawThreadInfo.minimallyEncoded,
+ `rawThreadInfos shouldn't be minimallyEncoded`,
+ );
+ return [id, rawThreadInfo];
+ }),
+ );
+}
+
export {
threadHasPermission,
viewerIsMember,
@@ -1822,4 +1837,5 @@
useRoleUserSurfacedPermissions,
getThreadsToDeleteText,
useUserProfileThreadInfo,
+ assertAllThreadInfosAreLegacy,
};
diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -39,6 +39,7 @@
import {
getContainingThreadID,
getCommunity,
+ assertAllThreadInfosAreLegacy,
} from 'lib/shared/thread-utils.js';
import {
DEPRECATED_unshimMessageStore,
@@ -73,6 +74,7 @@
import type {
ClientDBThreadInfo,
LegacyRawThreadInfo,
+ RawThreadInfo,
} from 'lib/types/thread-types.js';
import {
translateClientDBMessageInfoToRawMessageInfo,
@@ -379,7 +381,7 @@
return state;
}
- const threadInfos: { [string]: LegacyRawThreadInfo } = {};
+ const threadInfos: { [string]: RawThreadInfo } = {};
const stack = [...rootIDs];
while (stack.length > 0) {
const threadID = stack.shift();
@@ -403,9 +405,12 @@
return { ...state, threadStore: { ...state.threadStore, threadInfos } };
},
[29]: (state: AppState) => {
- const updatedThreadInfos = migrateThreadStoreForEditThreadPermissions(
- state.threadStore.threadInfos,
- );
+ const legacyRawThreadInfos: {
+ +[id: string]: LegacyRawThreadInfo,
+ } = assertAllThreadInfosAreLegacy(state.threadStore.threadInfos);
+
+ const updatedThreadInfos =
+ migrateThreadStoreForEditThreadPermissions(legacyRawThreadInfos);
return {
...state,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 10:34 PM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2433422
Default Alt Text
D10281.id34609.diff (3 KB)
Attached To
Mode
D10281: [native] Introduce `assertAllThreadInfosAreLegacy` to address migration 29 `flow` issues
Attached
Detach File
Event Timeline
Log In to Comment