From 094ecfbbfda7bf75bd1f7dbcef1ade98c850080e Mon Sep 17 00:00:00 2001 From: Ramon Souza <contato@ramonsouza.com> Date: Wed, 30 Jun 2021 11:29:03 -0300 Subject: [PATCH] fix reconnection crash --- .../imports/api/users-settings/server/publishers.js | 2 +- .../imports/ui/components/app/container.jsx | 11 ++++++----- .../components-data/chat-context/adapter.jsx | 2 +- .../components-data/users-context/context.jsx | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bigbluebutton-html5/imports/api/users-settings/server/publishers.js b/bigbluebutton-html5/imports/api/users-settings/server/publishers.js index cd7c68e73c..2b828e2b3d 100644 --- a/bigbluebutton-html5/imports/api/users-settings/server/publishers.js +++ b/bigbluebutton-html5/imports/api/users-settings/server/publishers.js @@ -16,7 +16,7 @@ function userSettings() { const currentUser = User.findOne({ userId, meetingId }); - if (currentUser && currentUser.breakoutProps.isBreakoutUser) { + if (currentUser && currentUser?.breakoutProps?.isBreakoutUser) { const { parentId } = currentUser.breakoutProps; const [externalId] = currentUser.extId.split('-'); diff --git a/bigbluebutton-html5/imports/ui/components/app/container.jsx b/bigbluebutton-html5/imports/ui/components/app/container.jsx index 204a6c26e7..784de29afd 100755 --- a/bigbluebutton-html5/imports/ui/components/app/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/app/container.jsx @@ -56,17 +56,18 @@ const AppContainer = (props) => { navbar, actionsbar, media, + currentUserId, ...otherProps } = props; - return ( + return currentUserId ? <App navbar={navbar} actionsbar={actionsbar} media={media} {...otherProps} /> - ); + : null }; const currentUserEmoji = currentUser => (currentUser ? { @@ -95,7 +96,7 @@ export default injectIntl(withModalMounter(withTracker(({ intl, baseControls }) { fields: { publishedPoll: 1, voiceProp: 1, randomlySelectedUser: 1 } }); const { publishedPoll, voiceProp, randomlySelectedUser } = currentMeeting; - if (!currentUser.approved) { + if (currentUser && !currentUser.approved) { baseControls.updateLoadingState(intl.formatMessage(intlMessages.waitingApprovalMessage)); } @@ -122,8 +123,8 @@ export default injectIntl(withModalMounter(withTracker(({ intl, baseControls }) startBandwidthMonitoring, handleNetworkConnection: () => updateNavigatorConnection(navigator.connection), randomlySelectedUser, - currentUserId: currentUser.userId, - isPresenter: currentUser.presenter, + currentUserId: currentUser?.userId, + isPresenter: currentUser?.presenter, isLargeFont: Session.get('isLargeFont') }; })(AppContainer))); diff --git a/bigbluebutton-html5/imports/ui/components/components-data/chat-context/adapter.jsx b/bigbluebutton-html5/imports/ui/components/components-data/chat-context/adapter.jsx index db9c29bb66..29bb43ba04 100644 --- a/bigbluebutton-html5/imports/ui/components/components-data/chat-context/adapter.jsx +++ b/bigbluebutton-html5/imports/ui/components/components-data/chat-context/adapter.jsx @@ -89,7 +89,7 @@ const Adapter = () => { /* needed to prevent an issue with dupĂÂșicated messages when user role is changed more info: https://github.com/bigbluebutton/bigbluebutton/issues/11842 */ useEffect(() => { - if (users[Auth.meetingID]) { + if (users[Auth.meetingID] && users[Auth.meetingID][Auth.userID]) { if (currentUserData?.role !== users[Auth.meetingID][Auth.userID].role) { prevUserData = currentUserData; } diff --git a/bigbluebutton-html5/imports/ui/components/components-data/users-context/context.jsx b/bigbluebutton-html5/imports/ui/components/components-data/users-context/context.jsx index 544c57860f..ff3c50bc96 100644 --- a/bigbluebutton-html5/imports/ui/components/components-data/users-context/context.jsx +++ b/bigbluebutton-html5/imports/ui/components/components-data/users-context/context.jsx @@ -55,7 +55,7 @@ const reducer = (state, action) => { // USER PERSISTENT DATA case ACTIONS.ADDED_USER_PERSISTENT_DATA: { const { user } = action.value; - if (state[user.meetingId][user.userId]) { + if (state[user.meetingId] && state[user.meetingId][user.userId]) { return state; } -- GitLab