bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/breakout-join-confirmation/container.jsx

46 lines
1.4 KiB
React
Raw Normal View History

2018-07-07 01:38:14 +08:00
import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import Breakouts from '/imports/api/breakouts';
import Auth from '/imports/ui/services/auth';
import { makeCall } from '/imports/ui/services/api';
import breakoutService from '/imports/ui/components/breakout-room/service';
2019-07-26 22:35:20 +08:00
import AudioManager from '/imports/ui/services/audio-manager';
2018-07-07 01:38:14 +08:00
import BreakoutJoinConfirmationComponent from './component';
const BreakoutJoinConfirmationContrainer = props => (
<BreakoutJoinConfirmationComponent
{...props}
/>
);
2018-07-07 01:38:14 +08:00
const getURL = (breakoutId) => {
const currentUserId = Auth.userID;
const getBreakout = Breakouts.findOne({ breakoutId }, { fields: { users: 1 } });
2018-07-07 01:38:14 +08:00
const user = getBreakout ? getBreakout.users.find(u => u.userId === currentUserId) : '';
if (user) return user.redirectToHtml5JoinURL;
return '';
};
const requestJoinURL = (breakoutId) => {
makeCall('requestJoinURL', {
breakoutId,
});
};
export default withTracker(({ breakout, mountModal, breakoutName }) => {
const isFreeJoin = breakout.freeJoin;
const { breakoutId } = breakout;
const url = getURL(breakoutId);
return {
isFreeJoin,
mountModal,
breakoutName,
breakoutURL: url,
breakouts: breakoutService.getBreakouts(),
2018-07-07 01:38:14 +08:00
requestJoinURL,
getURL,
2019-07-26 22:35:20 +08:00
voiceUserJoined: AudioManager.isUsingAudio(),
2018-07-07 01:38:14 +08:00
};
})(BreakoutJoinConfirmationContrainer);