diff --git a/web/modals/threads/members/members-modal.react.js b/web/modals/threads/members/members-modal.react.js --- a/web/modals/threads/members/members-modal.react.js +++ b/web/modals/threads/members/members-modal.react.js @@ -5,11 +5,7 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { userStoreSearchIndex } from 'lib/selectors/user-selectors.js'; -import { - memberHasAdminPowers, - memberIsAdmin, - threadHasPermission, -} from 'lib/shared/thread-utils.js'; +import { threadHasPermission } from 'lib/shared/thread-utils.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; import { type RelativeMemberInfo } from 'lib/types/thread-types.js'; @@ -20,6 +16,7 @@ import Tabs from '../../../components/tabs.react.js'; import { useSelector } from '../../../redux/redux-utils.js'; import SearchModal from '../../search-modal.react.js'; +import { useRoleNamesFromCommunityThreadInfo } from 'lib/utils/role-utils.js'; type ContentProps = { +searchText: string, @@ -47,13 +44,18 @@ ), [searchText.length, threadMembersNotFiltered, userIDs], ); + + const adminMembersMap = useRoleNamesFromCommunityThreadInfo( + threadInfo, + allMembers, + ); const adminMembers = React.useMemo( () => allMembers.filter( (member: RelativeMemberInfo) => - memberIsAdmin(member, threadInfo) || memberHasAdminPowers(member), + adminMembersMap.get(member.id) === 'Admins', ), - [allMembers, threadInfo], + [adminMembersMap, allMembers], ); const allUsersTab = React.useMemo(