snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
@@ -0,0 +1,243 @@
|
||||
import type { IRoom } from '@rocket.chat/core-typings';
|
||||
import type { SelectOption } from '@rocket.chat/fuselage';
|
||||
import { Box, Icon, TextInput, Select, Throbber, ButtonGroup, Button, Callout } from '@rocket.chat/fuselage';
|
||||
import { useAutoFocus, useDebouncedCallback } from '@rocket.chat/fuselage-hooks';
|
||||
import {
|
||||
VirtualizedScrollbars,
|
||||
ContextualbarHeader,
|
||||
ContextualbarIcon,
|
||||
ContextualbarTitle,
|
||||
ContextualbarClose,
|
||||
ContextualbarContent,
|
||||
ContextualbarFooter,
|
||||
ContextualbarEmptyContent,
|
||||
ContextualbarSection,
|
||||
ContextualbarDialog,
|
||||
} from '@rocket.chat/ui-client';
|
||||
import { useSetting } from '@rocket.chat/ui-contexts';
|
||||
import type { ChangeEventHandler, ComponentProps, MouseEvent, ElementType } from 'react';
|
||||
import { useId, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { GroupedVirtuoso } from 'react-virtuoso';
|
||||
|
||||
import { MembersListDivider } from './MembersListDivider';
|
||||
import RoomMembersListWrapper from './RoomMembersListWrapper';
|
||||
import RoomMembersRow from './RoomMembersRow';
|
||||
import InfiniteListAnchor from '../../../../components/InfiniteListAnchor';
|
||||
import ResultsLiveRegion from '../../../../components/ResultsLiveRegion';
|
||||
import type { RoomMember } from '../../../hooks/useMembersList';
|
||||
|
||||
export type RoomMembersProps = {
|
||||
rid: IRoom['_id'];
|
||||
isTeam?: boolean;
|
||||
isDirect?: boolean;
|
||||
isPending: boolean;
|
||||
isSuccess: boolean;
|
||||
text: string;
|
||||
type: string;
|
||||
setText: ChangeEventHandler<HTMLInputElement>;
|
||||
setType: (type: 'online' | 'all') => void;
|
||||
members: RoomMember[];
|
||||
total: number;
|
||||
error?: Error;
|
||||
onClickClose: () => void;
|
||||
onClickView: (e: MouseEvent<HTMLElement>) => void;
|
||||
onClickAdd?: () => void;
|
||||
onClickInvite?: () => void;
|
||||
loadMoreItems: () => void;
|
||||
renderRow?: ElementType<ComponentProps<typeof RoomMembersRow>>;
|
||||
reload: () => void;
|
||||
isABACRoom?: boolean;
|
||||
};
|
||||
|
||||
const RoomMembers = ({
|
||||
isPending,
|
||||
isSuccess,
|
||||
members = [],
|
||||
text,
|
||||
type = 'online',
|
||||
setText,
|
||||
setType,
|
||||
onClickClose,
|
||||
onClickView,
|
||||
onClickAdd,
|
||||
onClickInvite,
|
||||
total,
|
||||
error,
|
||||
loadMoreItems,
|
||||
renderRow: RowComponent = RoomMembersRow,
|
||||
rid,
|
||||
isTeam,
|
||||
isDirect,
|
||||
reload,
|
||||
isABACRoom = false,
|
||||
}: RoomMembersProps) => {
|
||||
const { t } = useTranslation();
|
||||
const membersListId = useId();
|
||||
const inputRef = useAutoFocus<HTMLInputElement>(true);
|
||||
const itemData = useMemo(() => ({ onClickView, rid }), [onClickView, rid]);
|
||||
|
||||
const options: SelectOption[] = useMemo(
|
||||
() => [
|
||||
['online', t('Online')],
|
||||
['all', t('All')],
|
||||
],
|
||||
[t],
|
||||
);
|
||||
|
||||
const loadMoreMembers = useDebouncedCallback(
|
||||
() => {
|
||||
loadMoreItems();
|
||||
},
|
||||
300,
|
||||
[loadMoreItems, members],
|
||||
);
|
||||
|
||||
const useRealName = useSetting('UI_Use_Real_Name', false);
|
||||
|
||||
const { counts, titles } = useMemo(() => {
|
||||
const owners: RoomMember[] = [];
|
||||
const leaders: RoomMember[] = [];
|
||||
const moderators: RoomMember[] = [];
|
||||
const normalMembers: RoomMember[] = [];
|
||||
|
||||
members.forEach((member) => {
|
||||
if (member.roles?.includes('owner')) {
|
||||
owners.push(member);
|
||||
} else if (member.roles?.includes('leader')) {
|
||||
leaders.push(member);
|
||||
} else if (member.roles?.includes('moderator')) {
|
||||
moderators.push(member);
|
||||
} else {
|
||||
normalMembers.push(member);
|
||||
}
|
||||
});
|
||||
|
||||
const counts = [];
|
||||
const titles = [];
|
||||
|
||||
if (owners.length > 0) {
|
||||
counts.push(owners.length);
|
||||
titles.push(<MembersListDivider title='Owners' count={owners.length} />);
|
||||
}
|
||||
|
||||
if (leaders.length > 0) {
|
||||
counts.push(leaders.length);
|
||||
titles.push(<MembersListDivider title='Leaders' count={leaders.length} />);
|
||||
}
|
||||
|
||||
if (moderators.length > 0) {
|
||||
counts.push(moderators.length);
|
||||
titles.push(<MembersListDivider title='Moderators' count={moderators.length} />);
|
||||
}
|
||||
|
||||
if (normalMembers.length > 0) {
|
||||
counts.push(normalMembers.length);
|
||||
titles.push(<MembersListDivider title='Members' count={normalMembers.length} />);
|
||||
}
|
||||
|
||||
return { counts, titles };
|
||||
}, [members]);
|
||||
|
||||
return (
|
||||
<ContextualbarDialog>
|
||||
<ContextualbarHeader>
|
||||
<ContextualbarIcon name='members' />
|
||||
<ContextualbarTitle>{isTeam ? t('Teams_members') : t('Members')}</ContextualbarTitle>
|
||||
{onClickClose && <ContextualbarClose onClick={onClickClose} />}
|
||||
</ContextualbarHeader>
|
||||
<ContextualbarSection>
|
||||
<TextInput
|
||||
placeholder={t('Search_by_username')}
|
||||
aria-label={t('Search_by_username')}
|
||||
aria-controls={isSuccess ? membersListId : undefined}
|
||||
value={text}
|
||||
ref={inputRef}
|
||||
onChange={setText}
|
||||
endAddon={<Icon name='magnifier' size='x20' />}
|
||||
/>
|
||||
<Box width='x144' marginInlineStart={8}>
|
||||
<Select
|
||||
aria-controls={isSuccess ? membersListId : undefined}
|
||||
options={options}
|
||||
value={type}
|
||||
onChange={(value): void => setType(value as 'online' | 'all')}
|
||||
/>
|
||||
</Box>
|
||||
</ContextualbarSection>
|
||||
<ContextualbarContent padding={0} paddingBlock={12}>
|
||||
<ResultsLiveRegion shouldAnnounce={isSuccess} itemCount={members.length} />
|
||||
{isPending && (
|
||||
<Box paddingInline={24} paddingBlock={12}>
|
||||
<Throbber size='x12' />
|
||||
</Box>
|
||||
)}
|
||||
{error && (
|
||||
<Box paddingInline={24} paddingBlock={12}>
|
||||
<Callout type='danger'>{error.message}</Callout>
|
||||
</Box>
|
||||
)}
|
||||
{isSuccess && (
|
||||
<>
|
||||
{members.length > 0 && (
|
||||
<Box paddingInline={24} paddingBlock={12}>
|
||||
<Box is='span' color='hint' fontScale='p2'>
|
||||
{t('Showing_current_of_total', { current: members.length, total })}
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
<Box id={membersListId} width='full' height='full' overflow='hidden' flexShrink={1}>
|
||||
{members.length <= 0 && <ContextualbarEmptyContent title={t('No_members_found')} />}
|
||||
{members.length > 0 && (
|
||||
<VirtualizedScrollbars>
|
||||
<GroupedVirtuoso
|
||||
style={{
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
}}
|
||||
overscan={50}
|
||||
groupCounts={counts}
|
||||
groupContent={(index) => titles[index]}
|
||||
components={{
|
||||
// eslint-disable-next-line react/no-multi-comp
|
||||
Footer: () => <InfiniteListAnchor loadMore={loadMoreMembers} />,
|
||||
List: RoomMembersListWrapper,
|
||||
}}
|
||||
itemContent={(index) => (
|
||||
<RowComponent useRealName={useRealName} data={itemData} user={members[index]} index={index} reload={reload} />
|
||||
)}
|
||||
/>
|
||||
</VirtualizedScrollbars>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
</ContextualbarContent>
|
||||
{!isDirect && (onClickInvite || onClickAdd) && (
|
||||
<ContextualbarFooter>
|
||||
<ButtonGroup stretch>
|
||||
{onClickInvite && (
|
||||
<Button
|
||||
icon='link'
|
||||
onClick={onClickInvite}
|
||||
width='50%'
|
||||
disabled={isABACRoom}
|
||||
title={isABACRoom ? t('Not_available_for_ABAC_enabled_rooms') : undefined}
|
||||
aria-label={t('Invite_Link')}
|
||||
>
|
||||
{t('Invite_Link')}
|
||||
</Button>
|
||||
)}
|
||||
{onClickAdd && (
|
||||
<Button icon='user-plus' onClick={onClickAdd} width='50%' primary>
|
||||
{t('Add')}
|
||||
</Button>
|
||||
)}
|
||||
</ButtonGroup>
|
||||
</ContextualbarFooter>
|
||||
)}
|
||||
</ContextualbarDialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default RoomMembers;
|
||||
Reference in New Issue
Block a user