From 7e8cee734069f29af372e5c2e01049f76eb11531 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Wed, 5 Oct 2022 11:30:12 -0300 Subject: [PATCH 01/12] improvement: error screen messages --- .../imports/api/users/server/methods/userLeaving.js | 2 +- bigbluebutton-html5/imports/startup/client/base.jsx | 2 +- .../imports/ui/components/app/container.jsx | 11 ++++++++++- .../imports/ui/components/error-screen/component.jsx | 11 ++++++++++- bigbluebutton-html5/imports/ui/services/auth/index.js | 5 +++++ bigbluebutton-html5/public/locales/en.json | 3 +++ 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js b/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js index c10163a2df..7ac13a2fbf 100755 --- a/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js +++ b/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js @@ -45,7 +45,7 @@ export default function userLeaving(meetingId, userId, connectionId) { ClientConnections.removeClientConnection(`${meetingId}--${userId}`, connectionId); - Logger.info(`User '${userId}' is leaving meeting '${meetingId}'`); + Logger.info(`User '${userId}' is leaving meeting '${meetingId} due to disconnection'`); RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload); } catch (err) { Logger.error(`Exception while invoking method userLeaving ${err.stack}`); diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index e237c997ac..1898236582 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -378,7 +378,7 @@ export default withTracker(() => { const connectionIdUpdateTime = User?.connectionIdUpdateTime; if (currentConnectionId && currentConnectionId !== connectionID && connectionIdUpdateTime > connectionAuthTime) { - Session.set('codeError', 403); + Session.set('codeError', 409); Session.set('errorMessageDescription', 'joined_another_window_reason') } diff --git a/bigbluebutton-html5/imports/ui/components/app/container.jsx b/bigbluebutton-html5/imports/ui/components/app/container.jsx index 4f8c069427..4679b96220 100755 --- a/bigbluebutton-html5/imports/ui/components/app/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/app/container.jsx @@ -194,7 +194,16 @@ export default injectIntl(withModalMounter(withTracker(({ intl, baseControls }) setTimeout(() => { const queryCurrentUser = Users.find({ userId: Auth.userID, meetingId: Auth.meetingID }); if (queryCurrentUser.count() === 0) { - endMeeting(403, userData.ejectedReason || null); + if (userData.ejected) { + endMeeting(403, userData.ejectedReason); + } else { + // Either authentication process hasn't finished yet or user did authenticate but Users + // collection is unsynchronized. In both cases user may be able to rejoin. + const description = Auth.isAuthenticating || Auth.loggedIn + ? 'able_to_rejoin_user_disconnected_reason' + : null; + endMeeting(503, description); + } } }, delayForReconnection); }, diff --git a/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx b/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx index 4013fcbf58..abf9803e10 100644 --- a/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx @@ -8,6 +8,9 @@ import logger from '/imports/startup/client/logger'; import Styled from './styles'; const intlMessages = defineMessages({ + 503: { + id: 'app.error.503', + }, 500: { id: 'app.error.500', defaultMessage: 'Oops, something went wrong', @@ -15,6 +18,9 @@ const intlMessages = defineMessages({ 410: { id: 'app.error.410', }, + 409: { + id: 'app.error.409', + }, 408: { id: 'app.error.408', }, @@ -55,6 +61,9 @@ const intlMessages = defineMessages({ not_enough_permission_eject_reason: { id: 'app.meeting.logout.permissionEjectReason', }, + able_to_rejoin_user_disconnected_reason: { + id: 'app.error.disconnected.rejoin', + }, }); const propTypes = { @@ -92,7 +101,7 @@ class ErrorScreen extends PureComponent { let errorMessageDescription = Session.get('errorMessageDescription'); - if (code === 403 && errorMessageDescription in intlMessages) { + if (errorMessageDescription in intlMessages) { errorMessageDescription = intl.formatMessage(intlMessages[errorMessageDescription]); } diff --git a/bigbluebutton-html5/imports/ui/services/auth/index.js b/bigbluebutton-html5/imports/ui/services/auth/index.js index 3b8da3a6fa..6b69d9beb3 100755 --- a/bigbluebutton-html5/imports/ui/services/auth/index.js +++ b/bigbluebutton-html5/imports/ui/services/auth/index.js @@ -210,10 +210,15 @@ class Auth { } this.loggedIn = false; + this.isAuthenticating = true; + return this.validateAuthToken() .then(() => { this.loggedIn = true; this.uniqueClientSession = `${this.sessionToken}-${Math.random().toString(36).substring(6)}`; + }) + .finally(() => { + this.isAuthenticating = false; }); } diff --git a/bigbluebutton-html5/public/locales/en.json b/bigbluebutton-html5/public/locales/en.json index 8f1a679274..12255ab847 100755 --- a/bigbluebutton-html5/public/locales/en.json +++ b/bigbluebutton-html5/public/locales/en.json @@ -663,8 +663,11 @@ "app.error.403": "You have been removed from the meeting", "app.error.404": "Not found", "app.error.408": "Authentication failed", + "app.error.409": "Conflict", "app.error.410": "Meeting has ended", "app.error.500": "Ops, something went wrong", + "app.error.503": "You have been disconnected", + "app.error.disconnected.rejoin": "You are able to refresh the page to rejoin.", "app.error.userLoggedOut": "User has an invalid sessionToken due to log out", "app.error.ejectedUser": "User has an invalid sessionToken due to ejection", "app.error.joinedAnotherWindow": "This session seems to be opened in another browser window.", From 2b84b80ba8e16121409c047d5b8f1f7df8662b5a Mon Sep 17 00:00:00 2001 From: GuiLeme Date: Thu, 6 Oct 2022 14:46:06 -0300 Subject: [PATCH 02/12] [fix-debounce-shared-notes] - fix debounce not working --- .../notes/converter-button/component.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx b/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx index cb2e476b36..dd728c9b0b 100644 --- a/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx @@ -4,11 +4,13 @@ import _ from 'lodash'; import { defineMessages, injectIntl } from 'react-intl'; import Service from './service'; import Styled from './styles'; +import { useState } from 'react'; const DEBOUNCE_TIMEOUT = 15000; const DEBOUNCE_OPTIONS = { leading: true, trailing: false, + maxWait: DEBOUNCE_TIMEOUT, }; const intlMessages = defineMessages({ @@ -28,15 +30,21 @@ const propTypes = { const ConverterButtonComponent = ({ intl, amIPresenter, -}) => (amIPresenter +}) => { + [converterButtonDisabled, setConverterButtonDisabled] = useState(false); + return (amIPresenter ? ( Service.convertAndUpload(), DEBOUNCE_TIMEOUT, DEBOUNCE_OPTIONS)} + disabled={converterButtonDisabled} + onClick={_.debounce(() => { + setConverterButtonDisabled(true); + setTimeout(() => setConverterButtonDisabled(false), DEBOUNCE_TIMEOUT); + return Service.convertAndUpload()}, DEBOUNCE_TIMEOUT, DEBOUNCE_OPTIONS)} label={intl.formatMessage(intlMessages.convertAndUploadLabel)} icon="upload" /> ) - : null); + : null)}; ConverterButtonComponent.propTypes = propTypes; From b77cab92bd061bdb638d57bb76e98b53b66bf07a Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Thu, 6 Oct 2022 15:58:41 -0300 Subject: [PATCH 03/12] fix: log the reason why the user is leaving. --- logout: user requested logout --- disconnection: user is being removed for disconnection reasons --- .../imports/api/users/server/methods/userLeaving.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js b/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js index 7ac13a2fbf..a6de99b28c 100755 --- a/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js +++ b/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js @@ -45,7 +45,9 @@ export default function userLeaving(meetingId, userId, connectionId) { ClientConnections.removeClientConnection(`${meetingId}--${userId}`, connectionId); - Logger.info(`User '${userId}' is leaving meeting '${meetingId} due to disconnection'`); + const reason = user.loggedOut ? 'logout' : 'disconnection'; + + Logger.info(`User '${userId}' is leaving meeting '${meetingId}' reason=${reason}`); RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload); } catch (err) { Logger.error(`Exception while invoking method userLeaving ${err.stack}`); From 912b7cf70c2bbc649922ba39477d6ee8555b9b80 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 7 Oct 2022 09:15:00 -0300 Subject: [PATCH 04/12] improvement: add setExitReason method --- .../imports/api/users/server/methods.js | 2 ++ .../api/users/server/methods/setExitReason.js | 18 +++++++++++++ .../server/modifiers/setUserExitReason.js | 25 +++++++++++++++++++ .../imports/startup/client/base.jsx | 13 ++++++++++ 4 files changed, 58 insertions(+) create mode 100644 bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js create mode 100644 bigbluebutton-html5/imports/api/users/server/modifiers/setUserExitReason.js diff --git a/bigbluebutton-html5/imports/api/users/server/methods.js b/bigbluebutton-html5/imports/api/users/server/methods.js index 55468e69a9..3d64c05d56 100644 --- a/bigbluebutton-html5/imports/api/users/server/methods.js +++ b/bigbluebutton-html5/imports/api/users/server/methods.js @@ -12,6 +12,7 @@ import userActivitySign from './methods/userActivitySign'; import userLeftMeeting from './methods/userLeftMeeting'; import changePin from './methods/changePin'; import setRandomUser from './methods/setRandomUser'; +import setExitReason from './methods/setExitReason'; Meteor.methods({ setEmojiStatus, @@ -27,4 +28,5 @@ Meteor.methods({ userLeftMeeting, changePin, setRandomUser, + setExitReason, }); diff --git a/bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js b/bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js new file mode 100644 index 0000000000..2dc009d44e --- /dev/null +++ b/bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js @@ -0,0 +1,18 @@ +import { check } from 'meteor/check'; +import Logger from '/imports/startup/server/logger'; +import { extractCredentials } from '/imports/api/common/server/helpers'; +import setUserExitReason from '/imports/api/users/server/modifiers/setUserExitReason'; + +export default function setExitReason(reason) { + try { + const { meetingId, requesterUserId } = extractCredentials(this.userId); + + check(meetingId, String); + check(requesterUserId, String); + check(reason, String); + + setUserExitReason(meetingId, requesterUserId, reason); + } catch (err) { + Logger.error(`Exception while invoking method setExitReason ${err.stack}`); + } +}; diff --git a/bigbluebutton-html5/imports/api/users/server/modifiers/setUserExitReason.js b/bigbluebutton-html5/imports/api/users/server/modifiers/setUserExitReason.js new file mode 100644 index 0000000000..c24f34002d --- /dev/null +++ b/bigbluebutton-html5/imports/api/users/server/modifiers/setUserExitReason.js @@ -0,0 +1,25 @@ +import Logger from '/imports/startup/server/logger'; +import Users from '/imports/api/users'; + +export default function setUserExitReason(meetingId, userId, reason) { + const selector = { + meetingId, + userId, + }; + + const modifier = { + $set: { + exitReason: reason, + }, + }; + + try { + const numberAffected = Users.update(selector, modifier); + + if (numberAffected) { + Logger.info(`Set exit reason userId=${userId} meeting=${meetingId}`); + } + } catch (err) { + Logger.error(`Setting user exit reason: ${err}`); + } +}; diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 1898236582..7d66109bb7 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -20,6 +20,7 @@ import VideoService from '/imports/ui/components/video-provider/service'; import DebugWindow from '/imports/ui/components/debug-window/component'; import { ACTIONS, PANELS } from '../../ui/components/layout/enums'; import { isChatEnabled } from '/imports/ui/services/features'; +import { makeCall } from '/imports/ui/services/api'; const CHAT_CONFIG = Meteor.settings.public.chat; const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id; @@ -238,6 +239,10 @@ class Base extends Component { }); } + static async setExitReason(reason) { + return makeCall('setExitReason', reason); + } + renderByState() { const { updateLoadingState } = this; const stateControls = { updateLoadingState }; @@ -259,20 +264,26 @@ class Base extends Component { } if (meetingIsBreakout && (ejected || userRemoved)) { + Base.setExitReason('removedFromBreakout'); window.close(); return null; } if (ejected) { + Base.setExitReason('ejected'); return (); } if ((meetingHasEnded || User?.loggedOut) && meetingIsBreakout) { + if (meetingHasEnded) { + Base.setExitReason('breakoutEnded'); + } window.close(); return null; } if (((meetingHasEnded && !meetingIsBreakout)) || (codeError && User?.loggedOut)) { + Base.setExitReason('meetingEnded'); return ( ); } return (); From 45199cb6ebddeed73987a4b48c238ba9bd78d948 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 7 Oct 2022 09:18:07 -0300 Subject: [PATCH 05/12] fix: stringify all codeError's --- bigbluebutton-html5/imports/startup/client/base.jsx | 2 +- bigbluebutton-html5/imports/ui/components/app/container.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 7d66109bb7..d283e2dd5c 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -391,7 +391,7 @@ export default withTracker(() => { const connectionIdUpdateTime = User?.connectionIdUpdateTime; if (currentConnectionId && currentConnectionId !== connectionID && connectionIdUpdateTime > connectionAuthTime) { - Session.set('codeError', 409); + Session.set('codeError', '409'); Session.set('errorMessageDescription', 'joined_another_window_reason') } diff --git a/bigbluebutton-html5/imports/ui/components/app/container.jsx b/bigbluebutton-html5/imports/ui/components/app/container.jsx index 4679b96220..0e62650b45 100755 --- a/bigbluebutton-html5/imports/ui/components/app/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/app/container.jsx @@ -195,14 +195,14 @@ export default injectIntl(withModalMounter(withTracker(({ intl, baseControls }) const queryCurrentUser = Users.find({ userId: Auth.userID, meetingId: Auth.meetingID }); if (queryCurrentUser.count() === 0) { if (userData.ejected) { - endMeeting(403, userData.ejectedReason); + endMeeting('403', userData.ejectedReason); } else { // Either authentication process hasn't finished yet or user did authenticate but Users // collection is unsynchronized. In both cases user may be able to rejoin. const description = Auth.isAuthenticating || Auth.loggedIn ? 'able_to_rejoin_user_disconnected_reason' : null; - endMeeting(503, description); + endMeeting('503', description); } } }, delayForReconnection); From a098933e0fb6b20fbcd7ffafa2e59c876b11c3c0 Mon Sep 17 00:00:00 2001 From: GuiLeme Date: Fri, 7 Oct 2022 09:40:46 -0300 Subject: [PATCH 06/12] [fix-debounce-shared-notes] - Added data-test to current presentation toast --- .../imports/ui/components/presentation/component.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/ui/components/presentation/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/component.jsx index 60862acbdc..97c46730f7 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/component.jsx @@ -854,7 +854,7 @@ class Presentation extends PureComponent { const { downloadable } = currentPresentation; return ( - + From 010f1c29648146ab7e9c5af15a25fb7141219c32 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 7 Oct 2022 10:38:50 -0300 Subject: [PATCH 07/12] tweak userLeaving and Base --- .../api/users/server/methods/userLeaving.js | 13 +++++++++- .../imports/startup/client/base.jsx | 25 +++++++++++-------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js b/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js index a6de99b28c..bcd6ba35c9 100755 --- a/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js +++ b/bigbluebutton-html5/imports/api/users/server/methods/userLeaving.js @@ -45,7 +45,18 @@ export default function userLeaving(meetingId, userId, connectionId) { ClientConnections.removeClientConnection(`${meetingId}--${userId}`, connectionId); - const reason = user.loggedOut ? 'logout' : 'disconnection'; + let reason; + + if (user.loggedOut) { + // User explicitly requested logout. + reason = 'logout'; + } else if (user.exitReason) { + // User didn't requested logout but exited graciously. + reason = user.exitReason; + } else { + // User didn't exit graciously (disconnection). + reason = 'disconnection'; + } Logger.info(`User '${userId}' is leaving meeting '${meetingId}' reason=${reason}`); RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload); diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index d283e2dd5c..394da6422b 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -240,7 +240,7 @@ class Base extends Component { } static async setExitReason(reason) { - return makeCall('setExitReason', reason); + return await makeCall('setExitReason', reason); } renderByState() { @@ -264,8 +264,10 @@ class Base extends Component { } if (meetingIsBreakout && (ejected || userRemoved)) { - Base.setExitReason('removedFromBreakout'); - window.close(); + Base.setExitReason('removedFromBreakout').finally(() => { + Meteor.disconnect(); + window.close(); + }); return null; } @@ -275,14 +277,15 @@ class Base extends Component { } if ((meetingHasEnded || User?.loggedOut) && meetingIsBreakout) { - if (meetingHasEnded) { - Base.setExitReason('breakoutEnded'); - } - window.close(); + const reason = meetingHasEnded ? 'breakoutEnded' : 'logout'; + Base.setExitReason(reason).finally(() => { + Meteor.disconnect(); + window.close(); + }); return null; } - if (((meetingHasEnded && !meetingIsBreakout)) || (codeError && User?.loggedOut)) { + if (meetingHasEnded && !meetingIsBreakout) { Base.setExitReason('meetingEnded'); return ( ); } + Base.setExitReason('logout'); return (); } From 550eb6aa2eed95c298aa63374f1094014dc6cc0e Mon Sep 17 00:00:00 2001 From: GuiLeme Date: Fri, 7 Oct 2022 14:36:02 -0300 Subject: [PATCH 08/12] [fix-export-to-chat-toast] - Fixed export to chat Toast --- .../presentation-uploader/component.jsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx index f3bf07b304..5d096e66e4 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx @@ -428,12 +428,26 @@ class PresentationUploader extends Component { const selected = propPresentations.filter((p) => p.isCurrent); if (selected.length > 0) Session.set('selectedToBeNextCurrent', selected[0].id); } + + if (this.exportToastId) { + if (!prevProps.isOpen && isOpen) { + this.handleDismissToast(this.exportToastId); + } + + toast.update(this.exportToastId, { + render: this.renderExportToast(), + }); + } } componentWillUnmount() { Session.set('showUploadPresentationView', false); } + handleDismissToast() { + return toast.dismiss(this.toastId); + } + handleFiledrop(files, files2) { const { fileValidMimeTypes, intl } = this.props; const { toUploadCount } = this.state; From 1046c08791142a9c651ca65bfc393aa2cfeba27c Mon Sep 17 00:00:00 2001 From: GuiLeme Date: Fri, 7 Oct 2022 16:10:08 -0300 Subject: [PATCH 09/12] [fix-debounce-shared-notes] - Changes in review --- .../ui/components/notes/converter-button/component.jsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx b/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx index dd728c9b0b..130c66d482 100644 --- a/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx @@ -1,17 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; -import _ from 'lodash'; import { defineMessages, injectIntl } from 'react-intl'; import Service from './service'; import Styled from './styles'; import { useState } from 'react'; const DEBOUNCE_TIMEOUT = 15000; -const DEBOUNCE_OPTIONS = { - leading: true, - trailing: false, - maxWait: DEBOUNCE_TIMEOUT, -}; const intlMessages = defineMessages({ convertAndUploadLabel: { @@ -36,10 +30,10 @@ const ConverterButtonComponent = ({ ? ( { + onClick={() => { setConverterButtonDisabled(true); setTimeout(() => setConverterButtonDisabled(false), DEBOUNCE_TIMEOUT); - return Service.convertAndUpload()}, DEBOUNCE_TIMEOUT, DEBOUNCE_OPTIONS)} + return Service.convertAndUpload()}} label={intl.formatMessage(intlMessages.convertAndUploadLabel)} icon="upload" /> From e4f53170099d9671fd8bf80a071bc14b44aa6208 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 7 Oct 2022 16:21:43 -0300 Subject: [PATCH 10/12] fix: unauthenticated user handling and manual disconnection --- .../api/users/server/methods/setExitReason.js | 3 +++ .../imports/startup/client/base.jsx | 18 +++++++++++------- .../ui/components/error-screen/component.jsx | 7 +++++-- .../ui/components/meeting-ended/component.jsx | 5 ++++- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js b/bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js index 2dc009d44e..b43bbf0b30 100644 --- a/bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js +++ b/bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js @@ -7,6 +7,9 @@ export default function setExitReason(reason) { try { const { meetingId, requesterUserId } = extractCredentials(this.userId); + // Unauthenticated user, just ignore and go ahead. + if (!meetingId || !requesterUserId) return; + check(meetingId, String); check(requesterUserId, String); check(reason, String); diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 394da6422b..4e2fd2ae4d 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -240,6 +240,7 @@ class Base extends Component { } static async setExitReason(reason) { + console.log('setting reason=' + reason); return await makeCall('setExitReason', reason); } @@ -272,8 +273,13 @@ class Base extends Component { } if (ejected) { - Base.setExitReason('ejected'); - return (); + return ( + Base.setExitReason('ejected')} + /> + ); } if ((meetingHasEnded || User?.loggedOut) && meetingIsBreakout) { @@ -286,12 +292,12 @@ class Base extends Component { } if (meetingHasEnded && !meetingIsBreakout) { - Base.setExitReason('meetingEnded'); return ( Base.setExitReason('meetingEnded')} /> ); } @@ -299,11 +305,9 @@ class Base extends Component { if (codeError && !meetingHasEnded) { // 680 is set for the codeError when the user requests a logout. if (codeError !== '680') { - Base.setExitReason('error'); - return (); + return ( Base.setExitReason('error')} />); } - Base.setExitReason('logout'); - return (); + return ( Base.setExitReason('logout')} />); } return (); diff --git a/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx b/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx index abf9803e10..e3714b96b0 100644 --- a/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/error-screen/component.jsx @@ -75,14 +75,17 @@ const propTypes = { const defaultProps = { code: 500, + callback: async () => {}, }; class ErrorScreen extends PureComponent { componentDidMount() { - const { code } = this.props; + const { code, callback } = this.props; const log = code === 403 ? 'warn' : 'error'; AudioManager.exitAudio(); - Meteor.disconnect(); + callback().finally(() => { + Meteor.disconnect(); + }); logger[log]({ logCode: 'startup_client_usercouldnotlogin_error' }, `User could not log in HTML5, hit ${code}`); } diff --git a/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx b/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx index 307e6a4944..0f7f94c94b 100755 --- a/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/meeting-ended/component.jsx @@ -116,6 +116,7 @@ const propTypes = { const defaultProps = { ejectedReason: null, endedReason: null, + callback: async () => {}, }; class MeetingEnded extends PureComponent { @@ -159,7 +160,9 @@ class MeetingEnded extends PureComponent { AudioManager.exitAudio(); Storage.removeItem('getEchoTest'); Storage.removeItem('isFirstJoin'); - Meteor.disconnect(); + this.props.callback().finally(() => { + Meteor.disconnect(); + }); } setSelectedStar(starNumber) { From ec837a1744f17e7ca0649f9b2ca0c00933f78ab6 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 7 Oct 2022 16:22:35 -0300 Subject: [PATCH 11/12] remove console.log --- bigbluebutton-html5/imports/startup/client/base.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 4e2fd2ae4d..c96f82f44b 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -240,7 +240,6 @@ class Base extends Component { } static async setExitReason(reason) { - console.log('setting reason=' + reason); return await makeCall('setExitReason', reason); } From 4391d762e8c1026c06fa11f74e766f7334c700f3 Mon Sep 17 00:00:00 2001 From: Joao Victor Date: Fri, 7 Oct 2022 16:43:34 -0300 Subject: [PATCH 12/12] add missing condition --- bigbluebutton-html5/imports/startup/client/base.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index c96f82f44b..9ca8112140 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -290,7 +290,7 @@ class Base extends Component { return null; } - if (meetingHasEnded && !meetingIsBreakout) { + if ((meetingHasEnded && !meetingIsBreakout) || (codeError && User?.loggedOut)) { return (