Fixes errors and improves parameters setting proccess
This commit is contained in:
parent
3458458cfd
commit
c4462c4cb0
@ -60,19 +60,30 @@ const currentParameters = [
|
||||
'bbb_outside_toggle_recording',
|
||||
];
|
||||
|
||||
function valueParser(val) {
|
||||
try {
|
||||
const parsedValue = JSON.parse(val.toLowerCase());
|
||||
return parsedValue;
|
||||
} catch (error) {
|
||||
logger.error('Parameter value could not ber parsed');
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
export default function addUserSettings(credentials, meetingId, userId, settings) {
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
check(settings, [Object]);
|
||||
|
||||
let parameters = {};
|
||||
|
||||
settings.forEach((el) => {
|
||||
const settingKey = Object.keys(el).shift();
|
||||
|
||||
if (currentParameters.includes(settingKey)) {
|
||||
if (!Object.keys(parameters).includes(settingKey)) {
|
||||
parameters = {
|
||||
[settingKey]: el[settingKey],
|
||||
[settingKey]: valueParser(el[settingKey]),
|
||||
...parameters,
|
||||
};
|
||||
} else {
|
||||
@ -83,11 +94,9 @@ export default function addUserSettings(credentials, meetingId, userId, settings
|
||||
|
||||
if (oldParametersKeys.includes(settingKey)) {
|
||||
const matchingNewKey = oldParameters[settingKey];
|
||||
const matchingNewKeyValue = el[settingKey];
|
||||
|
||||
if (!Object.keys(parameters).includes(matchingNewKey)) {
|
||||
parameters = {
|
||||
[matchingNewKey]: matchingNewKeyValue,
|
||||
[matchingNewKey]: valueParser(el[settingKey]),
|
||||
...parameters,
|
||||
};
|
||||
}
|
||||
|
@ -19,12 +19,16 @@ const propTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
mountModal: PropTypes.func.isRequired,
|
||||
isUserModerator: PropTypes.bool.isRequired,
|
||||
shortcuts: PropTypes.string.isRequired,
|
||||
shortcuts: PropTypes.string,
|
||||
handleTakePresenter: PropTypes.func.isRequired,
|
||||
allowExternalVideo: PropTypes.bool.isRequired,
|
||||
stopExternalVideoShare: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
const defaultProps = {
|
||||
shortcuts: '',
|
||||
};
|
||||
|
||||
const intlMessages = defineMessages({
|
||||
actionsLabel: {
|
||||
id: 'app.actionsBar.actionsDropdown.actionsLabel',
|
||||
@ -221,5 +225,6 @@ class ActionsDropdown extends PureComponent {
|
||||
}
|
||||
|
||||
ActionsDropdown.propTypes = propTypes;
|
||||
ActionsDropdown.defaultProps = defaultProps;
|
||||
|
||||
export default withShortcutHelper(withModalMounter(ActionsDropdown), 'openActions');
|
||||
|
@ -322,7 +322,6 @@ class App extends Component {
|
||||
const {
|
||||
customStyle, customStyleUrl, openPanel,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<main className={styles.main}>
|
||||
{this.renderActivityCheck()}
|
||||
|
@ -72,8 +72,8 @@ export default lockContextContainer(withModalMounter(withTracker(({ mountModal,
|
||||
inputDeviceId: Service.inputDeviceId(),
|
||||
outputDeviceId: Service.outputDeviceId(),
|
||||
showPermissionsOvelay: Service.isWaitingPermissions(),
|
||||
listenOnlyMode: JSON.parse(listenOnlyMode),
|
||||
skipCheck: JSON.parse(skipCheck),
|
||||
listenOnlyMode,
|
||||
skipCheck,
|
||||
formattedDialNum,
|
||||
formattedTelVoice,
|
||||
combinedDialInNum,
|
||||
|
@ -5,18 +5,20 @@ const BASE_SHORTCUTS = Meteor.settings.public.app.shortcuts;
|
||||
|
||||
const withShortcutHelper = (WrappedComponent, param) => (props) => {
|
||||
const ENABLED_SHORTCUTS = getFromUserSettings('bbb_shortcuts', null);
|
||||
|
||||
let shortcuts = Object.values(BASE_SHORTCUTS);
|
||||
|
||||
if (ENABLED_SHORTCUTS) {
|
||||
shortcuts = Object.values(BASE_SHORTCUTS)
|
||||
.filter(el => ENABLED_SHORTCUTS.includes(el.descId));
|
||||
shortcuts = Object.values(BASE_SHORTCUTS).map((el) => {
|
||||
const obj = { ...el };
|
||||
obj.descIdLowerCase = obj.descId.toLowerCase();
|
||||
return obj;
|
||||
}).filter(el => ENABLED_SHORTCUTS.includes(el.descIdLowerCase));
|
||||
}
|
||||
|
||||
if (param !== undefined) {
|
||||
if (!Array.isArray(param)) {
|
||||
shortcuts = shortcuts
|
||||
.filter(el => el.descId === param)
|
||||
.filter(el => el.descIdLowerCase === param.toLowerCase())
|
||||
.map(el => el.accesskey)
|
||||
.pop();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user