bigbluebutton-Github/bigbluebutton-html5/imports/api/polls/server/publishers.js

42 lines
912 B
JavaScript
Raw Normal View History

2016-10-21 21:21:09 +08:00
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
2017-10-12 08:33:57 +08:00
import Logger from '/imports/startup/server/logger';
import Polls from '/imports/api/polls';
2016-10-21 21:21:09 +08:00
2018-10-16 03:05:50 +08:00
Meteor.publish('current-poll', (meetingId) => {
2018-10-10 23:49:58 +08:00
check(meetingId, String);
const selector = {
meetingId,
};
Logger.debug(`Publishing poll for meeting=${meetingId}`);
2018-10-10 23:49:58 +08:00
return Polls.find(selector);
});
2017-06-01 01:54:43 +08:00
function polls(credentials) {
2016-10-21 21:21:09 +08:00
const { meetingId, requesterUserId, requesterToken } = credentials;
check(meetingId, String);
check(requesterUserId, String);
check(requesterToken, String);
Logger.debug(`Publishing polls =${meetingId} ${requesterUserId} ${requesterToken}`);
2017-10-12 08:33:57 +08:00
const selector = {
2017-06-03 03:25:02 +08:00
meetingId,
users: requesterUserId,
};
2017-06-06 03:12:06 +08:00
return Polls.find(selector);
}
function publish(...args) {
const boundPolls = polls.bind(this);
return boundPolls(...args);
2017-06-06 03:12:06 +08:00
}
Meteor.publish('polls', publish);