bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/end-meeting-confirmation/container.jsx

43 lines
1.3 KiB
React
Raw Normal View History

import React from 'react';
import { useMutation } from '@apollo/client';
import EndMeetingComponent from './component';
import logger from '/imports/startup/client/logger';
2024-01-10 22:07:42 +08:00
import { MEETING_END } from './mutations';
2024-04-11 20:53:58 +08:00
import { USER_AGGREGATE_COUNT_SUBSCRIPTION } from '/imports/ui/core/graphql/queries/users';
import useDeduplicatedSubscription from '../../core/hooks/useDeduplicatedSubscription';
import useMeeting from '../../core/hooks/useMeeting';
2024-01-10 22:07:42 +08:00
const EndMeetingContainer = (props) => {
const [meetingEnd] = useMutation(MEETING_END);
2024-04-11 20:53:58 +08:00
const {
data: countData,
} = useDeduplicatedSubscription(USER_AGGREGATE_COUNT_SUBSCRIPTION);
2024-04-11 20:53:58 +08:00
const users = countData?.user_aggregate?.aggregate?.count || 0;
2024-01-10 22:07:42 +08:00
const { setIsOpen } = props;
2024-01-10 22:07:42 +08:00
const endMeeting = () => {
logger.warn({
logCode: 'moderator_forcing_end_meeting',
extraInfo: { logType: 'user_action' },
}, 'this user clicked on EndMeeting and confirmed, removing everybody from the meeting');
2024-01-10 22:07:42 +08:00
meetingEnd();
setIsOpen(false);
};
const { data: meeting } = useMeeting((m) => ({
name: m.name,
}));
return (
<EndMeetingComponent
endMeeting={endMeeting}
users={users}
meetingTitle={meeting?.name}
{...props}
/>
);
2024-01-10 22:07:42 +08:00
};
export default EndMeetingContainer;