Merge pull request #4420 from Gcampes/fix-breakout-logout
[HTML5] Fix breakout logout
This commit is contained in:
commit
a356ef907c
@ -1,9 +1,17 @@
|
||||
import React, { Component } from 'react';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withRouter } from 'react-router';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import { defineMessages, injectIntl, intlShape } from 'react-intl';
|
||||
import Button from '/imports/ui/components/button/component';
|
||||
import Modal from '/imports/ui/components/modal/fullscreen/component';
|
||||
import styles from './styles.scss';
|
||||
import styles from './styles';
|
||||
|
||||
const propTypes = {
|
||||
handleEndMeeting: PropTypes.func.isRequired,
|
||||
intl: PropTypes.shape(intlShape).isRequired,
|
||||
router: PropTypes.object.isRequired,
|
||||
showEndMeeting: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
const intlMessages = defineMessages({
|
||||
title: {
|
||||
@ -40,38 +48,38 @@ const intlMessages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
class LeaveConfirmation extends Component {
|
||||
const LeaveConfirmation = ({
|
||||
intl,
|
||||
router,
|
||||
handleEndMeeting,
|
||||
showEndMeeting,
|
||||
}) => (
|
||||
<Modal
|
||||
title={intl.formatMessage(intlMessages.title)}
|
||||
confirm={{
|
||||
callback: () => router.push('/logout'),
|
||||
label: intl.formatMessage(intlMessages.confirmLabel),
|
||||
description: intl.formatMessage(intlMessages.confirmDesc),
|
||||
}}
|
||||
dismiss={{
|
||||
callback: () => null,
|
||||
label: intl.formatMessage(intlMessages.dismissLabel),
|
||||
description: intl.formatMessage(intlMessages.dismissDesc),
|
||||
}}
|
||||
>
|
||||
{intl.formatMessage(intlMessages.message)}
|
||||
{showEndMeeting ?
|
||||
<Button
|
||||
className={styles.endMeeting}
|
||||
label={intl.formatMessage(intlMessages.endMeetingLabel)}
|
||||
onClick={handleEndMeeting}
|
||||
aria-describedby={'modalEndMeetingDesc'}
|
||||
/> : null
|
||||
}
|
||||
<div id="modalEndMeetingDesc" hidden>{intl.formatMessage(intlMessages.endMeetingDesc)}</div>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
render() {
|
||||
const { intl, router, endMeeting, isModerator } = this.props;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={intl.formatMessage(intlMessages.title)}
|
||||
confirm={{
|
||||
callback: () => router.push('/logout'),
|
||||
label: intl.formatMessage(intlMessages.confirmLabel),
|
||||
description: intl.formatMessage(intlMessages.confirmDesc),
|
||||
}}
|
||||
dismiss={{
|
||||
callback: () => null,
|
||||
label: intl.formatMessage(intlMessages.dismissLabel),
|
||||
description: intl.formatMessage(intlMessages.dismissDesc),
|
||||
}}
|
||||
>
|
||||
{intl.formatMessage(intlMessages.message)}
|
||||
{isModerator ?
|
||||
<Button
|
||||
className={styles.endMeeting}
|
||||
label={intl.formatMessage(intlMessages.endMeetingLabel)}
|
||||
onClick={endMeeting}
|
||||
aria-describedby={'modalEndMeetingDesc'}
|
||||
/> : null
|
||||
}
|
||||
<div id="modalEndMeetingDesc" hidden>{intl.formatMessage(intlMessages.endMeetingDesc)}</div>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
LeaveConfirmation.propTypes = propTypes;
|
||||
|
||||
export default withRouter(injectIntl(LeaveConfirmation));
|
||||
|
@ -1,22 +1,14 @@
|
||||
import React, { Component } from 'react';
|
||||
import React from 'react';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import LogoutConfirmation from './component';
|
||||
import LogoutConfirmationService from './service';
|
||||
|
||||
class LogoutConfirmationContainer extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<LogoutConfirmation {...this.props} />
|
||||
);
|
||||
}
|
||||
}
|
||||
const LogoutConfirmationContainer = () => (
|
||||
<LogoutConfirmation {...this.props} />
|
||||
);
|
||||
|
||||
export default createContainer(() => ({
|
||||
isModerator: LogoutConfirmationService.isModerator(),
|
||||
showEndMeeting: !LogoutConfirmationService.isBreakout() &&
|
||||
LogoutConfirmationService.isModerator(),
|
||||
endMeeting: LogoutConfirmationService.endMeeting,
|
||||
}), LogoutConfirmationContainer);
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { makeCall } from '/imports/ui/services/api/index.js';
|
||||
import { makeCall } from '/imports/ui/services/api/index';
|
||||
import Users from '/imports/api/2.0/users';
|
||||
import Breakouts from '/imports/api/2.0/breakouts';
|
||||
import mapUser from '/imports/ui/services/user/mapUser';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
|
||||
@ -14,7 +15,10 @@ const isModerator = () => {
|
||||
return (currentUser) ? mapUser(currentUser).isModerator : null;
|
||||
};
|
||||
|
||||
const isBreakout = () => Breakouts.findOne({ breakoutId: Auth.meetingID });
|
||||
|
||||
export default {
|
||||
endMeeting,
|
||||
isModerator,
|
||||
isBreakout,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user