2021-09-02 03:38:33 +08:00
|
|
|
import React, { useContext } from 'react';
|
2018-11-09 02:55:12 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2021-10-20 04:35:39 +08:00
|
|
|
import Meetings from '/imports/api/meetings';
|
2018-11-17 03:17:17 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2018-11-09 02:55:12 +08:00
|
|
|
import LockViewersComponent from './component';
|
2019-09-09 22:21:54 +08:00
|
|
|
import { updateLockSettings, updateWebcamsOnlyForModerator } from './service';
|
2021-09-02 03:38:33 +08:00
|
|
|
import { UsersContext } from '../components-data/users-context/context';
|
2018-11-09 02:55:12 +08:00
|
|
|
|
2021-09-02 03:38:33 +08:00
|
|
|
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-09 02:55:12 +08:00
|
|
|
|
2023-03-23 22:56:00 +08:00
|
|
|
export default withTracker(({ setIsOpen }) => ({
|
|
|
|
closeModal: () => setIsOpen(false),
|
2019-08-30 00:26:07 +08:00
|
|
|
meeting: Meetings.findOne({ meetingId: Auth.meetingID }),
|
2019-09-09 22:21:54 +08:00
|
|
|
updateLockSettings,
|
|
|
|
updateWebcamsOnlyForModerator,
|
2019-09-10 21:43:06 +08:00
|
|
|
showToggleLabel: false,
|
2023-03-23 22:56:00 +08:00
|
|
|
}))(LockViewersContainer);
|