2021-07-19 22:02:58 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2022-01-21 01:50:16 +08:00
|
|
|
import { LayoutMeetings } from '/imports/api/meetings';
|
2021-07-19 22:02:58 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import { LAYOUT_TYPE } from '/imports/ui/components/layout/enums';
|
|
|
|
|
2022-03-23 02:29:49 +08:00
|
|
|
const APP_CONFIG = Meteor.settings.public.app.defaultSettings.application;
|
|
|
|
|
2022-03-09 23:09:56 +08:00
|
|
|
export default function changeLayout(meetingId, layout, presentationIsOpen, isResizing, cameraPosition, focusedCamera, presentationVideoRate, pushLayout, requesterUserId) {
|
2021-07-19 22:02:58 +08:00
|
|
|
try {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
2022-03-23 02:29:49 +08:00
|
|
|
check(isResizing, Boolean);
|
2021-07-19 22:02:58 +08:00
|
|
|
check(layout, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
2022-01-21 01:50:16 +08:00
|
|
|
layout: LAYOUT_TYPE[layout] || LAYOUT_TYPE.SMART_LAYOUT,
|
|
|
|
layoutUpdatedAt: new Date().getTime(),
|
2022-02-05 02:03:39 +08:00
|
|
|
presentationIsOpen,
|
2022-03-23 02:29:49 +08:00
|
|
|
isResizing,
|
2022-02-05 02:03:39 +08:00
|
|
|
cameraPosition,
|
|
|
|
focusedCamera,
|
|
|
|
presentationVideoRate,
|
2022-03-09 23:09:56 +08:00
|
|
|
pushLayout,
|
2021-07-19 22:02:58 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-01-21 01:50:16 +08:00
|
|
|
const numberAffected = LayoutMeetings.update(selector, modifier);
|
2021-07-19 22:02:58 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
2022-01-21 01:50:16 +08:00
|
|
|
Logger.info(`MeetingLayout changed to ${layout} for meeting=${meetingId} requested by user=${requesterUserId}`);
|
2021-07-19 22:02:58 +08:00
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method changeLayout ${err.stack}`);
|
|
|
|
}
|
|
|
|
}
|