Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3311508
D13536.id44766.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13536.id44766.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
@@ -1669,13 +1669,7 @@
);
}
-function useUserProfileThreadInfo(userInfo: ?UserInfo): ?UserProfileThreadInfo {
- const userID = userInfo?.id;
- const username = userInfo?.username;
-
- const loggedInUserInfo = useLoggedInUserInfo();
- const isViewerProfile = loggedInUserInfo?.id === userID;
-
+function useOldestPrivateThreadInfo(): ?ThreadInfo {
const genesisPrivateThreadInfosSelector = threadInfosSelectorForThreadType(
threadTypes.GENESIS_PRIVATE,
);
@@ -1686,11 +1680,21 @@
threadTypes.PRIVATE,
);
const privateThreadInfos = useSelector(privateThreadInfosSelector);
- const oldestPrivateThreadInfo = React.useMemo(
+ return React.useMemo(
() =>
getOldestCreated([...privateThreadInfos, ...genesisPrivateThreadInfos]),
[privateThreadInfos, genesisPrivateThreadInfos],
);
+}
+
+function useUserProfileThreadInfo(userInfo: ?UserInfo): ?UserProfileThreadInfo {
+ const userID = userInfo?.id;
+ const username = userInfo?.username;
+
+ const loggedInUserInfo = useLoggedInUserInfo();
+ const isViewerProfile = loggedInUserInfo?.id === userID;
+
+ const oldestPrivateThreadInfo = useOldestPrivateThreadInfo();
const usersWithPersonalThread = useSelector(usersWithPersonalThreadSelector);
const genesisPersonalThreadInfosSelector = threadInfosSelectorForThreadType(
@@ -1877,6 +1881,7 @@
useRoleNamesToSpecialRole,
useRoleUserSurfacedPermissions,
getThreadsToDeleteText,
+ useOldestPrivateThreadInfo,
useUserProfileThreadInfo,
assertAllThreadInfosAreLegacy,
useOnScreenEntryEditableThreadInfos,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 9:15 AM (18 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2543889
Default Alt Text
D13536.id44766.diff (1 KB)
Attached To
Mode
D13536: [lib] Factor out useOldestPrivateThreadInfo
Attached
Detach File
Event Timeline
Log In to Comment