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

34 lines
1.1 KiB
React
Raw Normal View History

import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
2024-04-11 20:53:58 +08:00
import { useMutation, useSubscription } from '@apollo/client';
import EndMeetingComponent from './component';
import Service from './service';
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';
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,
} = useSubscription(USER_AGGREGATE_COUNT_SUBSCRIPTION);
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);
};
2024-04-11 20:53:58 +08:00
return <EndMeetingComponent endMeeting={endMeeting} users={users} {...props} />;
2024-01-10 22:07:42 +08:00
};
export default withTracker(() => ({
2021-01-21 04:49:07 +08:00
meetingTitle: Service.getMeetingTitle(),
}))(EndMeetingContainer);