Merge pull request #5307 from Tainan404/webcam-only-moderator
Comply lock setting "see other viewer's webcams"
This commit is contained in:
commit
2cb81d3428
7
bigbluebutton-html5/imports/ui/components/media/container.jsx
Normal file → Executable file
7
bigbluebutton-html5/imports/ui/components/media/container.jsx
Normal file → Executable file
@ -1,8 +1,6 @@
|
||||
import React, { Component } from 'react';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import Settings from '/imports/ui/services/settings';
|
||||
import Meetings from '/imports/api/meetings/';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import { notify } from '/imports/ui/services/notification';
|
||||
import Media from './component';
|
||||
@ -85,9 +83,6 @@ export default withTracker(() => {
|
||||
const data = {};
|
||||
data.currentPresentation = MediaService.getPresentationInfo();
|
||||
|
||||
const meeting = Meetings.findOne({ meetingId: Auth.meetingID });
|
||||
const webcamOnlyModerator = meeting.usersProp.webcamsOnlyForModerator;
|
||||
|
||||
data.content = <DefaultContent />;
|
||||
|
||||
if (MediaService.shouldShowWhiteboard()) {
|
||||
@ -98,7 +93,7 @@ export default withTracker(() => {
|
||||
data.content = <ScreenshareContainer />;
|
||||
}
|
||||
|
||||
if (MediaService.shouldShowOverlay() && viewParticipantsWebcams && !webcamOnlyModerator) {
|
||||
if (MediaService.shouldShowOverlay() && viewParticipantsWebcams) {
|
||||
data.overlay = <VideoProviderContainer />;
|
||||
}
|
||||
|
||||
|
@ -86,11 +86,11 @@ class VideoDock extends Component {
|
||||
<div id="webcamArea" className={styles.webcamArea}>
|
||||
{this.props.users.map(user => (
|
||||
<VideoElement
|
||||
shared={id === user.userId && sharedWebcam}
|
||||
videoId={user.userId}
|
||||
key={user.userId}
|
||||
shared={id === user.id && sharedWebcam}
|
||||
videoId={user.id}
|
||||
key={user.id}
|
||||
name={user.name}
|
||||
localCamera={id === user.userId}
|
||||
localCamera={id === user.id}
|
||||
onShareWebcam={this.props.onShareWebcam.bind(this)}
|
||||
onMount={this.props.onStart.bind(this)}
|
||||
onUnmount={this.props.onStop.bind(this)}
|
||||
|
32
bigbluebutton-html5/imports/ui/components/video-provider/video-dock/container.jsx
Normal file → Executable file
32
bigbluebutton-html5/imports/ui/components/video-provider/video-dock/container.jsx
Normal file → Executable file
@ -1,34 +1,40 @@
|
||||
import React from 'react';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
import mapUser from '../../../services/user/mapUser';
|
||||
import Meetings from '/imports/api/meetings/';
|
||||
import Users from '/imports/api/users/';
|
||||
import mapUser from '/imports/ui/services/user/mapUser';
|
||||
import VideoDock from './component';
|
||||
import VideoService from '../service';
|
||||
|
||||
const VideoDockContainer = ({ children, ...props }) => <VideoDock {...props}>{children}</VideoDock>;
|
||||
|
||||
export default withTracker(({sharedWebcam}) => {
|
||||
export default withTracker(({ sharedWebcam }) => {
|
||||
const meeting = Meetings.findOne({ meetingId: Auth.meetingID });
|
||||
const lockCam = meeting.lockSettingsProp ? meeting.lockSettingsProp.disableCam : false;
|
||||
const userId = Auth.userID;
|
||||
const user = Users.findOne({ userId });
|
||||
const userLocked = mapUser(user).isLocked;
|
||||
const currentUser = Users.findOne({ userId });
|
||||
const currentUserIsModerator = mapUser(currentUser).isModerator;
|
||||
|
||||
const withActiveStreams = (users) => {
|
||||
const activeFilter = (user) => {
|
||||
const isLocked = lockCam && user.locked;
|
||||
return !isLocked && (user.has_stream || (sharedWebcam && user.userId == userId));
|
||||
};
|
||||
const isSharingWebcam = user => user.isSharingWebcam || (sharedWebcam && user.isCurrent);
|
||||
const isNotLocked = user => !(lockCam && user.isLocked);
|
||||
|
||||
return users.filter(activeFilter);
|
||||
}
|
||||
|
||||
const users = withActiveStreams(VideoService.getAllUsers());
|
||||
const isWebcamOnlyModerator = VideoService.webcamOnlyModerator();
|
||||
const allowedSeeViewersWebcams = !isWebcamOnlyModerator || currentUserIsModerator;
|
||||
const webcamOnlyModerator = (user) => {
|
||||
if (allowedSeeViewersWebcams) return true;
|
||||
return user.isModerator || user.isCurrent;
|
||||
};
|
||||
|
||||
const users = VideoService.getAllUsers()
|
||||
.map(mapUser)
|
||||
.filter(isSharingWebcam)
|
||||
.filter(isNotLocked)
|
||||
.filter(webcamOnlyModerator);
|
||||
|
||||
return {
|
||||
users,
|
||||
userId
|
||||
userId,
|
||||
};
|
||||
})(VideoDockContainer);
|
||||
|
@ -46,7 +46,7 @@ const JoinVideoOptionsContainer = (props) => {
|
||||
iconPath: `${baseName}/resources/images/video-menu/icon-webcam-off.svg`,
|
||||
description: intl.formatMessage(intlMessages[isSharingVideo ? 'leaveVideo' : 'joinVideo']),
|
||||
label: intl.formatMessage(intlMessages[isSharingVideo ? 'leaveVideo' : 'joinVideo']),
|
||||
disabled: isDisabled,
|
||||
disabled: isDisabled && !isSharingVideo,
|
||||
click: isSharingVideo ? handleCloseVideo : handleJoinVideo,
|
||||
},
|
||||
];
|
||||
|
@ -19,12 +19,14 @@ const isDisabled = () => {
|
||||
const videoSettings = Settings.dataSaving;
|
||||
const enableShare = videoSettings.viewParticipantsWebcams;
|
||||
const lockCam = VideoService.isLocked();
|
||||
const webcamOnlyModerator = VideoService.webcamOnlyModerator();
|
||||
|
||||
const user = Users.findOne({ userId: Auth.userID });
|
||||
const userLocked = mapUser(user).isLocked;
|
||||
|
||||
const isConnecting = (!isSharingVideo && isConnected);
|
||||
const isLocked = (lockCam && userLocked) || webcamOnlyModerator;
|
||||
|
||||
|
||||
const isLocked = (lockCam && userLocked);
|
||||
|
||||
return isLocked
|
||||
|| isWaitingResponse
|
||||
|
2
bigbluebutton-html5/imports/ui/services/user/mapUser.js
Normal file → Executable file
2
bigbluebutton-html5/imports/ui/services/user/mapUser.js
Normal file → Executable file
@ -26,7 +26,7 @@ const mapUser = (user) => {
|
||||
isMuted: voiceUser ? voiceUser.muted : false,
|
||||
isTalking: voiceUser ? voiceUser.talking : false,
|
||||
isListenOnly: voiceUser ? voiceUser.listenOnly : false,
|
||||
isSharingWebcam: 0,
|
||||
isSharingWebcam: user.has_stream,
|
||||
isPhoneUser: user.phone_user,
|
||||
isOnline: user.connectionStatus === 'online',
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user