diff --git a/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx b/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx index 800d6409e03e0c8c38cb70244c0725cd48cc92bb..297ee48d84444c471f344c70296ae62d1131c216 100644 --- a/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import { Meteor } from 'meteor/meteor'; import Button from '/imports/ui/components/button/component'; +import logoutRouteHandler from '/imports/utils/logoutRouteHandler'; import { styles } from './styles'; const intlMessages = defineMessages({ @@ -66,7 +67,7 @@ class ErrorScreen extends React.PureComponent { <div className={styles.content}> <Button size="sm" - onClick={() => Session.set('isMeetingEnded', true)} + onClick={logoutRouteHandler} label={intl.formatMessage(intlMessages.leave)} /> </div> diff --git a/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx b/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx index 0e491ba787dc0f467bbe70855cbb44175b2e5482..38011151da65c00ecc9e7871aa058346b3a81518 100644 --- a/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx @@ -71,6 +71,7 @@ class JoinHandler extends Component { return resp; }; + const setLogoutURL = (url) => Auth.logoutURL = url; const setLogoURL = (resp) => { setCustomLogoUrl(resp.customLogoURL); return resp; @@ -94,11 +95,12 @@ class JoinHandler extends Component { .then(response => response.json()) .then(({ response }) => response) .then((resp) => { + setLogoutURL(resp.logoutURL); if (resp.returncode !== 'FAILED') { logger.info(`User successfully went through main.joinRouteHandler with [${resp}].`); return resolve(resp); } - const e = new Error('Session not found'); + const e = new Error('Session not found'); logger.error(`User faced [${e}] on main.joinRouteHandler. Error was:`, JSON.stringify(resp)); return reject(e); }); diff --git a/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx b/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx index 8d91aa3c755a47091426bbdeb8654e9f8557bfa7..da34c76529daceaae9077e8b8611f75caa33f844 100755 --- a/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx @@ -5,6 +5,7 @@ import { Meteor } from 'meteor/meteor'; import Auth from '/imports/ui/services/auth'; import Button from '/imports/ui/components/button/component'; import getFromUserSettings from '/imports/ui/services/users-settings'; +import logoutRouteHandler from '/imports/utils/logoutRouteHandler'; import Rating from './rating/component'; import { styles } from './styles'; @@ -77,19 +78,6 @@ class MeetingEnded extends React.PureComponent { const comment = textarea.value; return comment; } - - static logoutRouteHandler() { - Auth.logout() - .then((logoutURL = window.location.origin) => { - const protocolPattern = /^((http|https):\/\/)/; - - window.location.href = - protocolPattern.test(logoutURL) ? - logoutURL : - `http://${logoutURL}`; - }); - } - constructor(props) { super(props); this.state = { @@ -116,7 +104,7 @@ class MeetingEnded extends React.PureComponent { } = this.state; if (selected <= 0) { - MeetingEnded.logoutRouteHandler(); + logoutRouteHandler(); return; } @@ -138,7 +126,7 @@ class MeetingEnded extends React.PureComponent { fetch(url, options) .finally(() => { - MeetingEnded.logoutRouteHandler(); + logoutRouteHandler(); }); } diff --git a/bigbluebutton-html5/imports/utils/logoutRouteHandler.js b/bigbluebutton-html5/imports/utils/logoutRouteHandler.js new file mode 100644 index 0000000000000000000000000000000000000000..c0febc21367d1bad7ef5475b4d9df34a3526c949 --- /dev/null +++ b/bigbluebutton-html5/imports/utils/logoutRouteHandler.js @@ -0,0 +1,15 @@ +import Auth from '/imports/ui/services/auth'; + +const logoutRouteHandler = () => { + Auth.logout() + .then((logoutURL = window.location.origin) => { + const protocolPattern = /^((http|https):\/\/)/; + + window.location.href = + protocolPattern.test(logoutURL) ? + logoutURL : + `http://${logoutURL}`; + }); +}; + +export default logoutRouteHandler;