diff --git a/web/modals/threads/members/members-list.react.js b/web/modals/threads/members/members-list.react.js index 170297f73..481e6be19 100644 --- a/web/modals/threads/members/members-list.react.js +++ b/web/modals/threads/members/members-list.react.js @@ -1,76 +1,77 @@ // @flow import classNames from 'classnames'; import _groupBy from 'lodash/fp/groupBy'; import _toPairs from 'lodash/fp/toPairs'; import * as React from 'react'; import { stringForUser } from 'lib/shared/user-utils'; import { type ThreadInfo, type RelativeMemberInfo, } from 'lib/types/thread-types'; import ThreadMember from './member.react'; import css from './members-modal.css'; type Props = { +threadInfo: ThreadInfo, +threadMembers: $ReadOnlyArray, }; function ThreadMembersList(props: Props): React.Node { const { threadMembers, threadInfo } = props; const [openMenu, setOpenMenu] = React.useState(null); const hasMembers = threadMembers.length > 0; const groupedByFirstLetterMembers = React.useMemo( - () => _groupBy(member => stringForUser(member)[0])(threadMembers), + () => + _groupBy(member => stringForUser(member)[0].toLowerCase())(threadMembers), [threadMembers], ); const groupedMembersList = React.useMemo( () => _toPairs(groupedByFirstLetterMembers) .sort((a, b) => a[0].localeCompare(b[0])) .map(([letter, users]) => { const userList = users .sort((a, b) => stringForUser(a).localeCompare(stringForUser(b))) .map((user: RelativeMemberInfo) => ( )); const letterHeader = (
{letter.toUpperCase()}
); return ( {letterHeader} {userList} ); }), [groupedByFirstLetterMembers, openMenu, threadInfo], ); let content = groupedMembersList; if (!hasMembers) { content = (
No matching users were found in the chat!
); } const membersListClasses = classNames(css.membersList, { [css.noScroll]: !!openMenu, }); return
{content}
; } export default ThreadMembersList;