Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3245582
D13939.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13939.diff
View Options
diff --git a/lib/hooks/user-identities-hooks.js b/lib/hooks/user-identities-hooks.js
--- a/lib/hooks/user-identities-hooks.js
+++ b/lib/hooks/user-identities-hooks.js
@@ -3,7 +3,10 @@
import * as React from 'react';
import { useFindUserIdentities } from '../actions/find-user-identities-actions.js';
-import { userHasDeviceList } from '../shared/thread-utils.js';
+import {
+ userHasDeviceList,
+ useHasThickThreadWithUser,
+} from '../shared/thread-utils.js';
import { useSelector } from '../utils/redux-utils.js';
function useUsersSupportThickThreads(): (
@@ -11,6 +14,7 @@
) => Promise<$ReadOnlySet<string>> {
const findUserIdentities = useFindUserIdentities();
const auxUserInfos = useSelector(state => state.auxUserStore.auxUserInfos);
+ const hasThickThreadWithUser = useHasThickThreadWithUser();
return React.useCallback(
async (userIDs: $ReadOnlyArray<string>) => {
@@ -18,7 +22,10 @@
const usersNeedingFetch = [];
for (const userID of userIDs) {
- if (userHasDeviceList(userID, auxUserInfos)) {
+ if (
+ userHasDeviceList(userID, auxUserInfos) ||
+ hasThickThreadWithUser(userID)
+ ) {
usersSupportingThickThreads.add(userID);
} else {
usersNeedingFetch.push(userID);
@@ -34,7 +41,7 @@
}
return usersSupportingThickThreads;
},
- [auxUserInfos, findUserIdentities],
+ [auxUserInfos, findUserIdentities, hasThickThreadWithUser],
);
}
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
@@ -37,6 +37,7 @@
pendingToRealizedThreadIDsSelector,
threadInfosSelectorForThreadType,
onScreenThreadInfos,
+ thickRawThreadInfosSelector,
} from '../selectors/thread-selectors.js';
import {
getRelativeMemberInfos,
@@ -1895,6 +1896,19 @@
);
}
+function useHasThickThreadWithUser(): (userID: string) => boolean {
+ const thickThreadInfos = useSelector(thickRawThreadInfosSelector);
+
+ return React.useCallback(
+ (userID: string): boolean => {
+ return values(thickThreadInfos).some(thread => {
+ return userIsMember(thread, userID);
+ });
+ },
+ [thickThreadInfos],
+ );
+}
+
export {
threadHasPermission,
useCommunityRootMembersToRole,
@@ -1965,4 +1979,5 @@
deviceListIsNonEmpty,
deviceListCanBeRequestedForUser,
expectedAccountDeletionUpdateTimeout,
+ useHasThickThreadWithUser,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 7:29 PM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2495177
Default Alt Text
D13939.diff (2 KB)
Attached To
Mode
D13939: [lib] Consider thread infos in useUsersSupportThickThreads()
Attached
Detach File
Event Timeline
Log In to Comment