bigbluebutton-Github/bigbluebutton-html5/imports/api/group-chat-msg/server/handlers/groupChatsMsgs.js

20 lines
482 B
JavaScript
Raw Normal View History

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;
}