bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/lock-viewers/context/container.jsx
2019-07-30 17:00:38 -03:00

30 lines
1.3 KiB
JavaScript

import { withTracker } from 'meteor/react-meteor-data';
import Meetings from '/imports/api/meetings';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import { LockStruct } from './context';
import { withLockContext } from './withContext';
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
const lockContextContainer = component => withTracker(() => {
const lockSetting = new LockStruct();
const Meeting = Meetings.findOne({ meetingId: Auth.meetingID });
const User = Users.findOne({ userId: Auth.userID });
const userIsLocked = User.locked && User.role === ROLE_MODERATOR;
const lockSettings = Meeting.lockSettingsProps;
lockSetting.isLocked = userIsLocked;
lockSetting.lockSettings = lockSettings;
lockSetting.userLocks.userWebcam = userIsLocked && lockSettings.disableCam;
lockSetting.userLocks.userMic = userIsLocked && lockSettings.disableMic;
lockSetting.userLocks.userNote = userIsLocked && lockSettings.disableNote;
lockSetting.userLocks.userPrivateChat = userIsLocked && lockSettings.disablePrivateChat;
lockSetting.userLocks.userPublicChat = userIsLocked && lockSettings.disablePublicChat;
lockSetting.userLocks.userLockedLayout = userIsLocked && lockSettings.lockedLayout;
return lockSetting;
})(withLockContext(component));
export default lockContextContainer;