Use main room custom parameters in breakouts room. close #9612

This commit is contained in:
Joao Siebel 2020-05-26 13:41:22 -03:00
parent 8539739f10
commit 74c34d0c4a
2 changed files with 33 additions and 1 deletions

View File

@ -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 });

View File

@ -180,7 +180,10 @@ class Base extends Component {
return (<MeetingEnded code="403" />);
}
if (meetingHasEnded && meetingIsBreakout) window.close();
if ((meetingHasEnded || User.loggedOut) && meetingIsBreakout) {
window.close();
return null;
}
if (((meetingHasEnded && !meetingIsBreakout)) || (codeError && (User && User.loggedOut))) {
AudioManager.exitAudio();