Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3342018
D6450.id21634.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
D6450.id21634.diff
View Options
diff --git a/web/modals/threads/members/add-members-modal.react.js b/web/modals/threads/members/add-members-modal.react.js
--- a/web/modals/threads/members/add-members-modal.react.js
+++ b/web/modals/threads/members/add-members-modal.react.js
@@ -6,6 +6,7 @@
changeThreadSettingsActionTypes,
changeThreadSettings,
} from 'lib/actions/thread-actions';
+import { useENSNames } from 'lib/hooks/ens-cache';
import { threadInfoSelector } from 'lib/selectors/thread-selectors';
import {
userSearchIndexForPotentialMembers,
@@ -77,6 +78,7 @@
userSearchIndex,
],
);
+ const userSearchResultsWithENSNames = useENSNames(userSearchResults);
const onSwitchUser = React.useCallback(
userID =>
@@ -112,35 +114,39 @@
threadID,
]);
- const pendingUsersWithNames = React.useMemo(
+ const pendingUserInfos = React.useMemo(
() =>
Array.from(pendingUsersToAdd)
- .map(userID => [userID, otherUserInfos[userID].username])
- .sort((a, b) => a[1].localeCompare(b[1])),
+ .map(userID => ({
+ id: userID,
+ username: otherUserInfos[userID].username,
+ }))
+ .sort((a, b) => a.username.localeCompare(b.username)),
[otherUserInfos, pendingUsersToAdd],
);
+ const pendingUserInfosWithENSNames = useENSNames(pendingUserInfos);
const labelItems = React.useMemo(() => {
- if (!pendingUsersWithNames.length) {
+ if (!pendingUserInfosWithENSNames.length) {
return null;
}
return (
<div className={css.addMembersPendingList}>
- {pendingUsersWithNames.map(([userID, username]) => (
- <Label key={userID} onClose={() => onSwitchUser(userID)}>
- {username}
+ {pendingUserInfosWithENSNames.map(userInfo => (
+ <Label key={userInfo.id} onClose={() => onSwitchUser(userInfo.id)}>
+ {userInfo.username}
</Label>
))}
</div>
);
- }, [onSwitchUser, pendingUsersWithNames]);
+ }, [onSwitchUser, pendingUserInfosWithENSNames]);
return (
<div className={css.addMembersContent}>
{labelItems}
<div className={css.addMembersListContainer}>
<AddMembersListContent
- userListItems={userSearchResults}
+ userListItems={userSearchResultsWithENSNames}
switchUser={onSwitchUser}
pendingUsersToAdd={pendingUsersToAdd}
hasParentThread={!!threadInfo.parentThreadID}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 12:12 AM (17 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2564563
Default Alt Text
D6450.id21634.diff (2 KB)
Attached To
Mode
D6450: [web] Fetch ENS names in AddMembersModal
Attached
Detach File
Event Timeline
Log In to Comment