bigbluebutton-Github/bigbluebutton-html5/imports/api/polls/server/methods/startPoll.js
Simon Hirtreiter 1c4186d7fd update bbb-html5 for multiple choice
Signed-off-by: Simon Hirtreiter <s.hirtreiter@hm.edu>
2021-02-04 14:59:16 +01:00

31 lines
908 B
JavaScript

import RedisPubSub from '/imports/startup/server/redis';
import { check } from 'meteor/check';
import { extractCredentials } from '/imports/api/common/server/helpers';
export default function startPoll(pollType, pollId, isMultipleChoice, answers) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
let EVENT_NAME = 'StartPollReqMsg';
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(pollId, String);
check(pollType, String);
const payload = {
requesterId: requesterUserId,
pollId: `${pollId}/${new Date().getTime()}`,
pollType,
//isMultipleChoice,
};
if (pollType === 'custom') {
EVENT_NAME = 'StartCustomPollReqMsg';
check(answers, Array);
payload.answers = answers;
}
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}