2016-11-19 01:35:28 +08:00
|
|
|
import { check } from 'meteor/check';
|
2018-05-12 00:01:24 +08:00
|
|
|
import { AnnotationsStreamer } from '/imports/api/annotations';
|
2016-11-19 01:35:28 +08:00
|
|
|
|
2017-10-12 08:52:57 +08:00
|
|
|
import clearAnnotations from '../modifiers/clearAnnotations';
|
2016-11-19 01:35:28 +08:00
|
|
|
|
2017-10-12 08:52:57 +08:00
|
|
|
export default function handleWhiteboardCleared({ body }, meetingId) {
|
|
|
|
check(body, {
|
|
|
|
userId: String,
|
|
|
|
whiteboardId: String,
|
|
|
|
fullClear: Boolean,
|
|
|
|
});
|
2016-11-19 01:35:28 +08:00
|
|
|
|
2017-10-12 08:52:57 +08:00
|
|
|
const { whiteboardId, fullClear, userId } = body;
|
2016-11-19 01:35:28 +08:00
|
|
|
|
2017-10-12 08:52:57 +08:00
|
|
|
if (fullClear) {
|
2018-05-12 00:01:24 +08:00
|
|
|
AnnotationsStreamer.emit('removed', { meetingId, whiteboardId });
|
2017-10-12 08:52:57 +08:00
|
|
|
return clearAnnotations(meetingId, whiteboardId);
|
|
|
|
}
|
|
|
|
|
2018-05-12 00:01:24 +08:00
|
|
|
AnnotationsStreamer.emit('removed', { meetingId, whiteboardId, userId });
|
2017-10-12 08:52:57 +08:00
|
|
|
return clearAnnotations(meetingId, whiteboardId, userId);
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|