bigbluebutton-Github/bigbluebutton-html5/imports/api/annotations/server/modifiers/addAnnotation.js
germanocaumo 835cf4f753 fix(whiteboard): diff shape update + shape permission +
Several improvements to tldraw whiteboard:
 - Only send the shape diff on shape updates (reduce a lot the message traffic)
 - Shape permissions (don't allow others to select/edit unless you are presenter/moderator)
  - This required some changes in akka model
 - Tldraw state patch changes to improve stability with fast updates (fix several crashes)
2022-10-21 14:05:31 +00:00

23 lines
773 B
JavaScript
Executable File

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Annotations from '/imports/api/annotations';
import addAnnotationQuery from '/imports/api/annotations/addAnnotation';
export default function addAnnotation(meetingId, whiteboardId, userId, annotation) {
check(meetingId, String);
check(whiteboardId, String);
check(annotation, Object);
const query = addAnnotationQuery(meetingId, whiteboardId, userId, annotation, Annotations);
try {
const { insertedId } = Annotations.upsert(query.selector, query.modifier);
if (insertedId) {
Logger.info(`Added annotation id=${annotation.id} whiteboard=${whiteboardId}`);
}
} catch (err) {
Logger.error(`Adding annotation to collection: ${err}`);
}
}