bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/lock-viewers/context/container.jsx
Ramón Souza 7514066fc3
fix: Client can't load in certain cases (#20336)
* move settings

* remove meteor cache files
2024-05-29 09:26:11 -04:00

33 lines
1.5 KiB
JavaScript

import { withTracker } from 'meteor/react-meteor-data';
import Meetings from '/imports/api/meetings';
import Auth from '/imports/ui/services/auth';
import { LockStruct } from './context';
import Users from '/imports/api/users';
import { withLockContext } from './withContext';
const lockContextContainer = (component) => withTracker(() => {
const lockSetting = new LockStruct();
const Meeting = Meetings.findOne({ meetingId: Auth.meetingID },
{ fields: { lockSettings: 1 } });
const User = Users.findOne({ userId: Auth.userID },
{ fields: { role: 1, locked: 1 } });
const ROLE_MODERATOR = window.meetingClientSettings.public.user.role_moderator;
const userIsLocked = User ? User.locked && User.role !== ROLE_MODERATOR : true;
const lockSettings = Meeting.lockSettings;
lockSetting.isLocked = userIsLocked;
lockSetting.lockSettings = lockSettings;
lockSetting.userLocks.userWebcam = userIsLocked && lockSettings.disableCam;
lockSetting.userLocks.userMic = userIsLocked && lockSettings.disableMic;
lockSetting.userLocks.userNotes = userIsLocked && lockSettings.disableNotes;
lockSetting.userLocks.userPrivateChat = userIsLocked && lockSettings.disablePrivateChat;
lockSetting.userLocks.userPublicChat = userIsLocked && lockSettings.disablePublicChat;
lockSetting.userLocks.hideViewersCursor = userIsLocked && lockSettings.hideViewersCursor;
lockSetting.userLocks.hideViewersAnnotation = userIsLocked && lockSettings.hideViewersAnnotation;
return lockSetting;
})(withLockContext(component));
export default lockContextContainer;