diff --git a/bigbluebutton-html5/imports/api/users-settings/server/publishers.js b/bigbluebutton-html5/imports/api/users-settings/server/publishers.js index 0b772099b4..399b1772aa 100644 --- a/bigbluebutton-html5/imports/api/users-settings/server/publishers.js +++ b/bigbluebutton-html5/imports/api/users-settings/server/publishers.js @@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor'; import UserSettings from '/imports/api/users-settings'; import Logger from '/imports/startup/server/logger'; import { extractCredentials } from '/imports/api/common/server/helpers'; +import User from '/imports/api/users'; function userSettings() { if (!this.userId) { @@ -9,6 +10,34 @@ function userSettings() { } const { meetingId, requesterUserId } = extractCredentials(this.userId); + const currentUser = User.findOne({ userId: requesterUserId }); + + if (currentUser && currentUser.breakoutProps.isBreakoutUser) { + const { parentId } = currentUser.breakoutProps; + + const [externalId] = currentUser.extId.split('-'); + + const mainRoomUserSettings = UserSettings.find({ meetingId: parentId, userId: externalId }); + + mainRoomUserSettings.map(({ setting, value }) => ({ + meetingId, + setting, + userId: requesterUserId, + value, + })).forEach((doc) => { + const selector = { + meetingId, + setting: doc.setting, + }; + + UserSettings.upsert(selector, doc); + }); + + Logger.debug(`Publishing user settings for user=${externalId}`); + + return UserSettings.find({ meetingId, userId: requesterUserId }); + } + Logger.debug(`Publishing user settings for user=${requesterUserId}`); return UserSettings.find({ meetingId, userId: requesterUserId }); diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 6e339759b0..f141757aff 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -180,7 +180,10 @@ class Base extends Component { return (); } - if (meetingHasEnded && meetingIsBreakout) window.close(); + if ((meetingHasEnded || User.loggedOut) && meetingIsBreakout) { + window.close(); + return null; + } if (((meetingHasEnded && !meetingIsBreakout)) || (codeError && (User && User.loggedOut))) { AudioManager.exitAudio();