2019-01-15 05:39:03 +08:00
|
|
|
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';
|
2019-01-15 05:39:03 +08:00
|
|
|
import EndMeetingComponent from './component';
|
2020-06-26 20:45:03 +08:00
|
|
|
import Service from './service';
|
2020-09-25 02:45:52 +08:00
|
|
|
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';
|
2019-01-15 05:39:03 +08:00
|
|
|
|
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;
|
2019-01-15 05:39:03 +08:00
|
|
|
|
2024-01-10 22:07:42 +08:00
|
|
|
const endMeeting = () => {
|
2020-09-25 02:45:52 +08:00
|
|
|
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(),
|
2023-03-21 21:00:46 +08:00
|
|
|
}))(EndMeetingContainer);
|