bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/waiting-users/guest-policy/container.jsx

31 lines
907 B
React
Raw Normal View History

import React from 'react';
2020-02-04 04:41:12 +08:00
import { withTracker } from 'meteor/react-meteor-data';
2024-01-10 20:07:38 +08:00
import { useMutation } from '@apollo/client';
2020-02-04 04:41:12 +08:00
import GuestPolicyComponent from './component';
import Service from '../service';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
2024-01-10 20:07:38 +08:00
import { SET_POLICY } from '../mutations';
2020-02-04 04:41:12 +08:00
2022-11-23 00:16:46 +08:00
const GuestPolicyContainer = (props) => {
const { data: currentUserData } = useCurrentUser((user) => ({
isModerator: user.isModerator,
}));
const amIModerator = currentUserData?.isModerator;
2024-01-10 20:07:38 +08:00
const [setPolicy] = useMutation(SET_POLICY);
const changeGuestPolicy = (guestPolicy) => {
setPolicy({
variables: {
guestPolicy,
},
});
};
return amIModerator && <GuestPolicyComponent changeGuestPolicy={changeGuestPolicy} {...props} />;
};
2020-02-04 04:41:12 +08:00
export default withTracker(() => ({
2020-02-04 04:41:12 +08:00
guestPolicy: Service.getGuestPolicy(),
}))(GuestPolicyContainer);