bigbluebutton-Github/bigbluebutton-html5/imports/api/annotations/server/handlers/whiteboardAnnotations.js

29 lines
910 B
JavaScript
Raw Normal View History

import _ from 'lodash';
2016-11-19 01:35:28 +08:00
import { check } from 'meteor/check';
2018-04-10 07:18:49 +08:00
import modifyWhiteboardAccess from '/imports/api/whiteboard-multi-user/server/modifiers/modifyWhiteboardAccess';
import clearAnnotations from '../modifiers/clearAnnotations';
import addAnnotation from '../modifiers/addAnnotation';
2016-11-19 01:35:28 +08:00
export default function handleWhiteboardAnnotations({ header, body }, meetingId) {
check(header, Object);
if (header.userId !== 'nodeJSapp') { return false; }
2016-11-19 01:35:28 +08:00
check(meetingId, String);
check(body, Object);
2016-11-19 01:35:28 +08:00
2018-04-10 07:18:49 +08:00
const { annotations, whiteboardId, multiUser } = body;
2018-04-10 07:18:49 +08:00
check(annotations, Array);
check(whiteboardId, String);
check(multiUser, Array);
2018-04-10 07:18:49 +08:00
clearAnnotations(meetingId, whiteboardId);
_.each(annotations, (annotation) => {
const { wbId, userId } = annotation;
2021-04-09 21:08:59 +08:00
addAnnotation(meetingId, wbId, userId, annotation);
2016-11-19 01:35:28 +08:00
});
2018-04-10 07:18:49 +08:00
modifyWhiteboardAccess(meetingId, whiteboardId, multiUser);
2017-06-03 03:25:02 +08:00
}