Resolve Alex cherry-pick
This commit is contained in:
parent
e23d75c16b
commit
4e31181690
2
bigbluebutton-html5/imports/api/2.0/annotation/server/eventHandlers.js
Normal file → Executable file
2
bigbluebutton-html5/imports/api/2.0/annotation/server/eventHandlers.js
Normal file → Executable file
@ -2,7 +2,9 @@ import RedisPubSub from '/imports/startup/server/redis2x';
|
||||
import handleWhiteboardCleared from './handlers/whiteboardCleared';
|
||||
import handleWhiteboardUndo from './handlers/whiteboardUndo';
|
||||
import handleWhiteboardSend from './handlers/whiteboardSend';
|
||||
import handleWhiteboardAnnotations from './handlers/whiteboardAnnotations';
|
||||
|
||||
RedisPubSub.on('ClearWhiteboardEvtMsg', handleWhiteboardCleared);
|
||||
RedisPubSub.on('UndoWhiteboardEvtMsg', handleWhiteboardUndo);
|
||||
RedisPubSub.on('SendWhiteboardAnnotationEvtMsg', handleWhiteboardSend);
|
||||
RedisPubSub.on('GetWhiteboardAnnotationsRespMsg', handleWhiteboardAnnotations);
|
||||
|
@ -0,0 +1,30 @@
|
||||
import _ from 'lodash';
|
||||
import { check } from 'meteor/check';
|
||||
import Annotations from '/imports/api/2.0/annotations';
|
||||
import addAnnotation from '../modifiers/addAnnotation';
|
||||
import removeAnnotation from '../modifiers/removeAnnotation';
|
||||
|
||||
export default function handleWhiteboardAnnotations({ body }, meetingId) {
|
||||
check(meetingId, String);
|
||||
check(body, Object);
|
||||
|
||||
const { annotations, whiteboardId } = body;
|
||||
const annotationIds = annotations.map(annotation => annotation.id);
|
||||
const annotationsToRemove = Annotations.find({
|
||||
meetingId,
|
||||
wbId: whiteboardId,
|
||||
'annotationInfo.id': { $nin: annotationIds },
|
||||
}).fetch();
|
||||
|
||||
_.each(annotationsToRemove, (annotation) => {
|
||||
removeAnnotation(meetingId, annotation.whiteboardId, annotation.annotationInfo.id);
|
||||
});
|
||||
|
||||
const annotationsAdded = [];
|
||||
_.each(annotations, (annotation) => {
|
||||
const { wbId, userId } = annotation;
|
||||
annotationsAdded.push(addAnnotation(meetingId, wbId, userId, annotation));
|
||||
});
|
||||
|
||||
return annotationsAdded;
|
||||
}
|
Loading…
Reference in New Issue
Block a user