Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3374316
D3743.id11513.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
D3743.id11513.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
@@ -2,7 +2,16 @@
import * as React from 'react';
+import { threadInfoSelector } from 'lib/selectors/thread-selectors';
+import {
+ userSearchIndexForPotentialMembers,
+ userInfoSelectorForPotentialMembers,
+} from 'lib/selectors/user-selectors';
+import { getPotentialMemberItems } from 'lib/shared/search-utils';
+import { threadActualMembers } from 'lib/shared/thread-utils';
+
import Button from '../../../components/button.react';
+import { useSelector } from '../../../redux/redux-utils';
import SearchModal from '../../search-modal.react';
import AddMembersList from './add-members-list.react';
import css from './members-modal.css';
@@ -14,13 +23,46 @@
};
function AddMembersModalContent(props: ContentProps): React.Node {
- const { onClose } = props;
+ const { searchText, threadID, onClose } = props;
const [pendingUsersToAdd, setpendingUsersToAdd] = React.useState<
$ReadOnlyArray<string>,
>([]);
- const userSearchResults = [];
+ const threadInfo = useSelector(state => threadInfoSelector(state)[threadID]);
+ const { parentThreadID, community } = threadInfo;
+ const parentThreadInfo = useSelector(state =>
+ parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
+ );
+ const communityThreadInfo = useSelector(state =>
+ community ? threadInfoSelector(state)[community] : null,
+ );
+ const otherUserInfos = useSelector(userInfoSelectorForPotentialMembers);
+ const userSearchIndex = useSelector(userSearchIndexForPotentialMembers);
+ const excludeUserIDs = React.useMemo(
+ () => threadActualMembers(threadInfo.members),
+ [threadInfo.members],
+ );
+
+ const userSearchResults = React.useMemo(() => {
+ return getPotentialMemberItems(
+ searchText,
+ otherUserInfos,
+ userSearchIndex,
+ excludeUserIDs,
+ parentThreadInfo,
+ communityThreadInfo,
+ threadInfo.type,
+ );
+ }, [
+ communityThreadInfo,
+ excludeUserIDs,
+ otherUserInfos,
+ parentThreadInfo,
+ searchText,
+ threadInfo.type,
+ userSearchIndex,
+ ]);
const onSwitchUser = React.useCallback(
userID =>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 3:01 PM (19 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2590746
Default Alt Text
D3743.id11513.diff (2 KB)
Attached To
Mode
D3743: [web] Introduce searching users in `AddMembersModal`
Attached
Detach File
Event Timeline
Log In to Comment