let server handle parameters
This commit is contained in:
parent
e750ceb0a1
commit
bb58a3fde6
@ -5,11 +5,45 @@ import addUserSetting from '/imports/api/users-settings/server/modifiers/addUser
|
||||
export default function addUserSettings(credentials, meetingId, userId, settings) {
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
check(settings, Object);
|
||||
check(settings, [Object]);
|
||||
|
||||
const customData = settings.reduce((acc, data) => {
|
||||
const key = Object.keys(data).shift();
|
||||
|
||||
const handledHTML5Parameters = [
|
||||
'html5recordingbot',
|
||||
// APP
|
||||
'autoJoin',
|
||||
'listenOnlyMode',
|
||||
'forceListenOnly',
|
||||
'skipCheck',
|
||||
// 'clientTitle',
|
||||
'lockOnJoin', // NOT IMPLEMENTED YET
|
||||
'askForFeedbackOnLogout',
|
||||
// BRANDING
|
||||
'displayBrandingArea',
|
||||
// KURENTO
|
||||
'enableScreensharing',
|
||||
'enableVideo',
|
||||
'enableVideoStats',
|
||||
// WHITEBOARD
|
||||
];
|
||||
if (!handledHTML5Parameters.includes(key)) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
let value = data[key];
|
||||
try {
|
||||
value = JSON.parse(value);
|
||||
} catch (e) {
|
||||
console.log('error', `Caught: ${e.message}`);
|
||||
}
|
||||
return { ...acc, [key]: value };
|
||||
}, {});
|
||||
|
||||
const settingsAdded = [];
|
||||
|
||||
Object.entries(settings).forEach((el) => {
|
||||
Object.entries(customData).forEach((el) => {
|
||||
const setting = el[0];
|
||||
const value = el[1];
|
||||
settingsAdded.push(addUserSetting(meetingId, userId, setting, value));
|
||||
|
@ -60,44 +60,8 @@ export function joinRouteHandler(nextState, replace, callback) {
|
||||
return { ...acc, [key]: value };
|
||||
}, {}) : {};
|
||||
|
||||
const customData = customdata.length
|
||||
? customdata.reduce((acc, data) => {
|
||||
const key = Object.keys(data).shift();
|
||||
|
||||
const handledHTML5Parameters = [
|
||||
'html5recordingbot',
|
||||
// APP
|
||||
'autoJoin',
|
||||
'listenOnlyMode',
|
||||
'forceListenOnly',
|
||||
'skipCheck',
|
||||
'clientTitle',
|
||||
'lockOnJoin', // NOT IMPLEMENTED YET
|
||||
'askForFeedbackOnLogout',
|
||||
// BRANDING
|
||||
'displayBrandingArea',
|
||||
// KURENTO
|
||||
'enableScreensharing',
|
||||
'enableVideo',
|
||||
'enableVideoStats',
|
||||
// WHITEBOARD
|
||||
];
|
||||
if (handledHTML5Parameters.indexOf(key) === -1) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
let value = data[key];
|
||||
try {
|
||||
value = JSON.parse(value);
|
||||
} catch (e) {
|
||||
log('error', `Caught: ${e.message}`);
|
||||
}
|
||||
|
||||
return { ...acc, [key]: value };
|
||||
}, {}) : {};
|
||||
|
||||
if (Object.keys(customData).length > 0) {
|
||||
makeCall('addUserSettings', meetingID, internalUserID, customData);
|
||||
if (customdata.length) {
|
||||
makeCall('addUserSettings', meetingID, internalUserID, customdata);
|
||||
}
|
||||
|
||||
SessionStorage.setItem(METADATA_KEY, metakeys);
|
||||
|
Loading…
Reference in New Issue
Block a user