bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/polling/service.js

26 lines
565 B
JavaScript
Raw Normal View History

2016-05-13 03:50:02 +08:00
import { Polls } from '/imports/api/polls';
import { callServer } from '/imports/ui/services/api';
2016-05-06 02:50:18 +08:00
let mapPolls = function () {
let poll = Polls.findOne({});
if (!poll) {
return { pollExists: false };
}
const amIRequester = poll.requester != 'userId';
return {
poll: {
answers: poll.poll.answers,
pollId: poll.poll.id,
},
pollExists: true,
amIRequester: amIRequester,
handleVote: function (pollId, answerId) {
callServer('publishVoteMessage', pollId, answerId.id);
2016-05-06 02:50:18 +08:00
},
};
};
export default { mapPolls };