bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/video-provider/many-users-notify/container.jsx

38 lines
1.6 KiB
React
Raw Normal View History

2019-06-13 02:03:23 +08:00
import { withTracker } from 'meteor/react-meteor-data';
import Meetings from '/imports/ui/local-collections/meetings-collection/meetings';
2019-06-13 02:03:23 +08:00
import Auth from '/imports/ui/services/auth';
import Users from '/imports/api/users/';
2019-09-07 00:50:31 +08:00
import VideoStreams from '/imports/api/video-streams';
2019-06-13 02:03:23 +08:00
import LockViewersService from '/imports/ui/components/lock-viewers/service';
import ManyUsersComponent from './component';
const USER_CONFIG = Meteor.settings.public.user;
const ROLE_MODERATOR = USER_CONFIG.role_moderator;
const ROLE_VIEWER = USER_CONFIG.role_viewer;
export default withTracker(() => {
2019-09-06 21:19:18 +08:00
const meeting = Meetings.findOne({
meetingId: Auth.meetingID,
}, { fields: { 'usersProp.webcamsOnlyForModerator': 1, lockSettingsProps: 1 } });
2019-09-07 00:50:31 +08:00
const videoStreams = VideoStreams.find({ meetingId: Auth.meetingID },
2019-09-06 04:03:22 +08:00
{ fields: { userId: 1 } }).fetch();
2019-09-07 00:50:31 +08:00
const videoUsersIds = videoStreams.map(u => u.userId);
return {
viewersInWebcam: Users.find({
meetingId: Auth.meetingID,
userId: {
$in: videoUsersIds,
},
role: ROLE_VIEWER,
presenter: false,
2019-09-06 04:03:22 +08:00
}, { fields: {} }).count(),
2019-09-05 02:32:58 +08:00
currentUserIsModerator: Users.findOne({ userId: Auth.userID },
{ fields: { role: 1 } })?.role === ROLE_MODERATOR,
2019-09-10 03:30:14 +08:00
lockSettings: meeting.lockSettingsProps,
2019-09-05 02:32:58 +08:00
webcamOnlyForModerator: meeting.usersProp.webcamsOnlyForModerator,
limitOfViewersInWebcam: Meteor.settings.public.app.viewersInWebcam,
limitOfViewersInWebcamIsEnable: Meteor.settings.public.app.enableLimitOfViewersInWebcam,
toggleWebcamsOnlyForModerator: LockViewersService.toggleWebcamsOnlyForModerator,
};
})(ManyUsersComponent);