Skip to content
Snippets Groups Projects
Commit 59eb0441 authored by Oswaldo Acauan's avatar Oswaldo Acauan
Browse files

Clean captions when handling the history reply

parent edae8ea1
No related branches found
No related tags found
No related merge requests found
import _ from 'underscore';
import Captions from '/imports/api/captions';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import { inReplyToHTML5Client } from '/imports/api/common/server/helpers';
......@@ -37,6 +38,14 @@ export default function handleCaptionHistory({ payload }) {
}
}
const selectorToRemove = {
meetingId,
locale,
'captionHistory.index': { $gt: (chunks.length - 1) },
};
Captions.remove(selectorToRemove);
chunks.forEach((captions, index) => {
let captionHistoryObject = {
locale,
......@@ -48,6 +57,7 @@ export default function handleCaptionHistory({ payload }) {
captionsAdded.push(addCaption(meetingId, locale, captionHistoryObject));
});
});
return captionsAdded;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment