Merge pull request #7175 from Tainan404/fix-dropdown-console-error

Open breakout room in new tab automatically when request new join url
This commit is contained in:
Anton Georgiev 2019-04-08 18:35:32 -04:00 committed by GitHub
commit 1a6ca170eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 15 deletions

View File

@ -303,7 +303,8 @@ class BreakoutRoom extends Component {
}
blurDurationTime(event) {
this.setState({ durationTime: Number.parseInt(event.target.value, 10) || 1 });
const value = Number.parseInt(event.target.value, 10);
this.setState({ durationTime: !(value <= 0) ? value : 1 });
}
changeNumberOfRooms(event) {

View File

@ -61,7 +61,6 @@ class BreakoutRoom extends Component {
this.state = {
requestedBreakoutId: '',
waiting: false,
generated: false,
joinedAudioOnly: false,
breakoutId: '',
};
@ -76,18 +75,18 @@ class BreakoutRoom extends Component {
const {
waiting,
generated,
requestedBreakoutId,
} = this.state;
if (breakoutRooms.length <= 0) closeBreakoutPanel();
if (waiting && !generated) {
if (waiting) {
const breakoutUser = breakoutRoomUser(requestedBreakoutId);
if (!breakoutUser) return;
if (breakoutUser.redirectToHtml5JoinURL !== '') {
_.delay(() => this.setState({ generated: true, waiting: false }), 1000);
window.open(breakoutUser.redirectToHtml5JoinURL, '_blank');
_.delay(() => this.setState({ waiting: false }), 1000);
}
}
}
@ -101,15 +100,14 @@ class BreakoutRoom extends Component {
{
waiting: true,
requestedBreakoutId: breakoutId,
generated: false,
},
() => requestJoinURL(breakoutId),
);
}
if (hasUser) {
window.open(hasUser.redirectToHtml5JoinURL);
this.setState({ waiting: false, generated: false });
window.open(hasUser.redirectToHtml5JoinURL, '_blank');
this.setState({ waiting: false });
}
return null;
}
@ -136,7 +134,6 @@ class BreakoutRoom extends Component {
const {
joinedAudioOnly,
breakoutId: stateBreakoutId,
generated,
requestedBreakoutId,
waiting,
} = this.state;
@ -149,12 +146,8 @@ class BreakoutRoom extends Component {
return (
<div className={styles.breakoutActions}>
<Button
label={generated && requestedBreakoutId === breakoutId
? intl.formatMessage(intlMessages.generatedURL)
: intl.formatMessage(intlMessages.breakoutJoin)}
aria-label={generated && requestedBreakoutId === breakoutId
? intl.formatMessage(intlMessages.generatedURL)
: `${intl.formatMessage(intlMessages.breakoutJoin)} ${number}`}
label={intl.formatMessage(intlMessages.breakoutJoin)}
aria-label={`${intl.formatMessage(intlMessages.breakoutJoin)} ${number}`}
onClick={() => this.getBreakoutURL(breakoutId)}
disabled={disable}
className={styles.joinButton}