2019-01-15 05:39:03 +08:00
|
|
|
import React from 'react';
|
2024-06-04 21:40:54 +08:00
|
|
|
import { useMutation } from '@apollo/client';
|
2019-01-15 05:39:03 +08:00
|
|
|
import EndMeetingComponent from './component';
|
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';
|
2024-06-04 21:40:54 +08:00
|
|
|
import useDeduplicatedSubscription from '../../core/hooks/useDeduplicatedSubscription';
|
2024-05-16 21:56:27 +08:00
|
|
|
import useMeeting from '../../core/hooks/useMeeting';
|
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,
|
2024-06-04 21:40:54 +08:00
|
|
|
} = 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;
|
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-05-16 21:56:27 +08:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2024-05-16 21:56:27 +08:00
|
|
|
export default EndMeetingContainer;
|