Merge pull request #19616 from JoVictorNunes/issue-19571

fix(layout): `defaultLayout` join parameter
This commit is contained in:
Ramón Souza 2024-02-27 13:17:20 -03:00 committed by GitHub
commit 4879d3e688
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 5 deletions

View File

@ -8,6 +8,9 @@ import { makeCall } from '/imports/ui/services/api';
import logger from '/imports/startup/client/logger';
import LoadingScreen from '/imports/ui/components/common/loading-screen/component';
import { CurrentUser } from '/imports/api/users';
import Settings from '/imports/ui/services/settings';
import { updateSettings } from '/imports/ui/components/settings/service';
import { LAYOUT_TYPE } from '/imports/ui/components/layout/enums';
const propTypes = {
children: PropTypes.element.isRequired,
@ -178,6 +181,16 @@ class JoinHandler extends Component {
Session.set('bannerColor', resp.bannerColor);
};
const setUserDefaultLayout = (response) => {
const settings = {
application: {
...Settings.application,
selectedLayout: LAYOUT_TYPE[response.defaultLayout] || 'custom',
},
};
updateSettings(settings);
};
// use enter api to get params for the client
const url = `${APP.bbbWebBase}/api/enter?sessionToken=${sessionToken}`;
const fetchContent = await fetch(url, { credentials: 'include' });
@ -199,6 +212,7 @@ class JoinHandler extends Component {
.findOne({ userId: Auth.userID, approved: true }, { fields: { _id: 1 } });
if (user) {
await setCustomData(response);
setUserDefaultLayout(response);
cd.stop();
}
});

View File

@ -56,7 +56,6 @@ class PushLayoutEngine extends React.Component {
cameraHeight,
horizontalPosition,
layoutContextDispatch,
meetingLayout,
meetingLayoutCameraPosition,
meetingLayoutFocusedCamera,
meetingLayoutVideoRate,
@ -65,10 +64,12 @@ class PushLayoutEngine extends React.Component {
shouldShowExternalVideo,
} = this.props;
const userLayout = LAYOUT_TYPE[getFromUserSettings('bbb_change_layout', false)];
Settings.application.selectedLayout = userLayout || meetingLayout;
const changedLayout = getFromUserSettings('bbb_change_layout', null);
if (changedLayout) {
Settings.application.selectedLayout = LAYOUT_TYPE[changedLayout];
}
let selectedLayout = Settings.application.selectedLayout;
let { selectedLayout } = Settings.application;
if (isMobile()) {
selectedLayout = selectedLayout === 'custom' ? 'smart' : selectedLayout;
Settings.application.selectedLayout = selectedLayout;

View File

@ -47,7 +47,7 @@ const joinEndpointTableData = [
"name": "defaultLayout",
"required": false,
"type": "String",
"description": (<>The layout name to be loaded first when the application is loaded.</>)
"description": (<>The layout name to be loaded first when the application is loaded. If none is provided, the meeting layout will be used.</>)
},
{
"name": "avatarURL",