bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/lock-viewers/container.jsx

28 lines
1.1 KiB
React
Raw Normal View History

import React, { useContext } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
2022-02-15 23:54:55 +08:00
import { withModalMounter } from '/imports/ui/components/common/modal/service';
import Meetings from '/imports/api/meetings';
import Auth from '/imports/ui/services/auth';
import LockViewersComponent from './component';
import { updateLockSettings, updateWebcamsOnlyForModerator } from './service';
import { UsersContext } from '../components-data/users-context/context';
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
const LockViewersContainer = (props) => {
const usingUsersContext = useContext(UsersContext);
const { users } = usingUsersContext;
const currentUser = users[Auth.meetingID][Auth.userID];
const amIModerator = currentUser.role === ROLE_MODERATOR;
return amIModerator && <LockViewersComponent {...props} />
}
2018-11-20 20:46:21 +08:00
export default withModalMounter(withTracker(({ mountModal }) => ({
closeModal: () => mountModal(null),
meeting: Meetings.findOne({ meetingId: Auth.meetingID }),
updateLockSettings,
updateWebcamsOnlyForModerator,
showToggleLabel: false,
2018-11-20 20:46:21 +08:00
}))(LockViewersContainer));