diff --git a/web/settings/relationship/add-users-list.react.js b/web/settings/relationship/add-users-list.react.js --- a/web/settings/relationship/add-users-list.react.js +++ b/web/settings/relationship/add-users-list.react.js @@ -4,6 +4,7 @@ import { searchUsers } from 'lib/actions/user-actions.js'; import { userStoreSearchIndex as userStoreSearchIndexSelector } from 'lib/selectors/user-selectors.js'; +import type { UserRelationshipStatus } from 'lib/types/relationship-types.js'; import type { GlobalAccountUserInfo } from 'lib/types/user-types.js'; import { useServerCall } from 'lib/utils/action-utils.js'; @@ -11,10 +12,11 @@ type Props = { +searchText: string, + +excludedStatuses?: $ReadOnlySet, }; function AddUsersList(props: Props): React.Node { - const { searchText } = props; + const { searchText, excludedStatuses = new Set() } = props; const userStoreSearchIndex = useSelector(userStoreSearchIndexSelector); const [userStoreSearchResults, setUserStoreSearchResults] = React.useState< @@ -74,10 +76,10 @@ for (const userID in mergedUserInfos) { users.push(mergedUserInfos[userID]); } - return users.sort((user1, user2) => - user1.username.localeCompare(user2.username), - ); - }, [mergedUserInfos]); + return users + .filter(user => !excludedStatuses.has(user.relationshipStatus)) + .sort((user1, user2) => user1.username.localeCompare(user2.username)); + }, [excludedStatuses, mergedUserInfos]); return null; }