diff --git a/web/modals/threads/members/add-members-group.react.js b/web/modals/threads/members/add-members-group.react.js --- a/web/modals/threads/members/add-members-group.react.js +++ b/web/modals/threads/members/add-members-group.react.js @@ -8,7 +8,7 @@ import css from './members-modal.css'; type AddMemberItemGroupProps = { - +header: string, + +header: ?string, +userInfos: $ReadOnlyArray, +onUserClick: (userID: string) => void, +usersAdded: $ReadOnlySet, @@ -32,10 +32,13 @@ )), [onUserClick, sortedUserInfos, usersAdded], ); + const headerComponent = header ? ( +
{header}:
+ ) : null; return ( <> -
{header}:
+ {headerComponent} {userInfosComponents} ); diff --git a/web/modals/threads/members/add-members-list.react.js b/web/modals/threads/members/add-members-list.react.js --- a/web/modals/threads/members/add-members-list.react.js +++ b/web/modals/threads/members/add-members-list.react.js @@ -12,10 +12,16 @@ +userListItems: $ReadOnlyArray, +pendingUsersToAdd: $ReadOnlySet, +switchUser: string => void, + +hasParentThread: boolean, }; function AddMembersList(props: Props): React.Node { - const { userListItems, pendingUsersToAdd, switchUser } = props; + const { + userListItems, + pendingUsersToAdd, + switchUser, + hasParentThread, + } = props; const usersAvailableToAdd = React.useMemo( () => userListItems.filter(user => !user.alertText), @@ -27,13 +33,13 @@ [usersAvailableToAdd], ); - const membersInParentThread = React.useMemo( - () => - groupedAvailableUsersList['undefined'] - ? ['Users in parent channel', groupedAvailableUsersList['undefined']] - : undefined, - [groupedAvailableUsersList], - ); + const membersInParentThread = React.useMemo(() => { + if (!groupedAvailableUsersList['undefined']) { + return; + } + const label = hasParentThread ? 'Users in parent channel' : null; + return [label, groupedAvailableUsersList['undefined']]; + }, [groupedAvailableUsersList, hasParentThread]); const membersNotInParentThread = React.useMemo( () => 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 @@ -143,6 +143,7 @@ userListItems={userSearchResults} switchUser={onSwitchUser} pendingUsersToAdd={pendingUsersToAdd} + hasParentThread={!!threadInfo.parentThreadID} />