bigbluebutton-Github/bigbluebutton-html5/imports/api/group-chat-msg/server/handlers/groupChatsMsgs.js
2018-03-09 15:42:14 -03:00

20 lines
482 B
JavaScript

import { Match, check } from 'meteor/check';
import addGroupChatMsg from '../modifiers/addGroupChatMsg';
export default function handleGroupChatsMsgs({ body }, meetingId) {
const { chatId, msgs, msg } = body;
check(meetingId, String);
check(chatId, String);
check(msgs, Match.Maybe(Array));
check(msg, Match.Maybe(Array));
const msgsAdded = [];
(msgs || msg).forEach((m) => {
msgsAdded.push(addGroupChatMsg(meetingId, chatId, m));
});
return msgsAdded;
}