bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/lock-viewers/context/container.jsx
2019-05-23 13:47:56 -03:00

35 lines
1.5 KiB
JavaScript

import React from 'react';
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 mapUser from '/imports/ui/services/user/mapUser';
import { DataStruct } from './context';
import { withLockContext } from './withContext';
const lockContextContainer = component => withTracker(() => {
const lockSetting = new DataStruct();
const Meeting = Meetings.findOne({ meetingId: Auth.meetingID });
const User = Users.findOne({ userId: Auth.userID });
const mappedUser = mapUser(User);
const userIsLocked = mappedUser.isLocked;
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.userLockOnJoin = userIsLocked && lockSettings.lockOnJoin;
lockSetting.userLocks.userLockedLayout = userIsLocked && lockSettings.lockedLayout;
lockSetting.userLocks.userOnJoinConfigurable = userIsLocked
&& lockSettings.lockOnJoinConfigurable;
return lockSetting;
})(withLockContext(component));
export default lockContextContainer;