835cf4f753
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)
37 lines
704 B
JavaScript
Executable File
37 lines
704 B
JavaScript
Executable File
import { check } from 'meteor/check';
|
|
import _ from "lodash";
|
|
|
|
export default function addAnnotation(meetingId, whiteboardId, userId, annotation, Annotations) {
|
|
check(meetingId, String);
|
|
check(whiteboardId, String);
|
|
check(annotation, Object);
|
|
|
|
const {
|
|
id, wbId,
|
|
} = annotation;
|
|
|
|
let { annotationInfo } = annotation;
|
|
|
|
const selector = {
|
|
meetingId,
|
|
id,
|
|
};
|
|
|
|
const oldAnnotation = Annotations.findOne(selector);
|
|
if (oldAnnotation) {
|
|
annotationInfo = _.merge(oldAnnotation.annotationInfo, annotationInfo)
|
|
}
|
|
|
|
const modifier = {
|
|
$set: {
|
|
whiteboardId,
|
|
meetingId,
|
|
id,
|
|
annotationInfo,
|
|
wbId,
|
|
},
|
|
};
|
|
|
|
return { selector, modifier };
|
|
}
|