Merge pull request #3686 from oswaldoacauan/fix-reply-messages-remove

[HTML5] Fix presentations/shapes reply messages
This commit is contained in:
Anton Georgiev 2017-03-02 11:44:26 -05:00 committed by GitHub
commit e67b2a733e
3 changed files with 22 additions and 1 deletions

View File

@ -1,8 +1,10 @@
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import { inReplyToHTML5Client } from '/imports/api/common/server/helpers';
import Presentations from '/imports/api/presentations';
import addPresentation from '../modifiers/addPresentation';
import removePresentation from '../modifiers/removePresentation';
export default function handlePresentationInfoReply({ payload }) {
if (!inReplyToHTML5Client({ payload })) {
@ -15,6 +17,14 @@ export default function handlePresentationInfoReply({ payload }) {
check(meetingId, String);
check(presentations, Array);
const presentationsIds = presentations.map(_ => _.id);
const presentationsToRemove = Presentations.find({
meetingId,
'presentation.id': { $nin: presentationsIds },
}).fetch();
presentationsToRemove.forEach(p => removePresentation(meetingId, p.presentation.id));
let presentationsAdded = [];
presentations.forEach(presentation => {
presentationsAdded.push(addPresentation(meetingId, presentation));

View File

@ -1,8 +1,10 @@
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import { inReplyToHTML5Client } from '/imports/api/common/server/helpers';
import Shapes from '/imports/api/shapes';
import addShape from '../modifiers/addShape';
import removeShape from '../modifiers/removeShape';
export default function handleWhiteboardGetReply({ payload }) {
if (!inReplyToHTML5Client({ payload })) {
@ -15,6 +17,14 @@ export default function handleWhiteboardGetReply({ payload }) {
check(meetingId, String);
check(shapes, Array);
const shapesIds = shapes.map(_ => _.id);
const shapesToRemove = Shapes.find({
meetingId,
'shape.id': { $nin: shapesIds },
}).fetch();
shapesToRemove.forEach(s => removeShape(meetingId, s.shape.wb_id, s.shape.id));
let shapesAdded = [];
shapes.forEach(shape => {
let whiteboardId = shape.wb_id;

View File

@ -65,8 +65,9 @@ export default function addSlide(meetingId, presentationId, slide) {
const { insertedId } = numChanged;
requestWhiteboardHistory(meetingId, slide.id);
if (insertedId) {
requestWhiteboardHistory(meetingId, slide.id);
return Logger.info(`Added slide id=${slide.id} to presentation=${presentationId}`);
}