2017-06-27 02:00:28 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import mapToAcl from '/imports/startup/mapToAcl';
|
2017-07-14 04:21:27 +08:00
|
|
|
import Breakouts from '/imports/api/2.0/breakouts';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2017-06-27 02:00:28 +08:00
|
|
|
|
|
|
|
function breakouts(credentials) {
|
|
|
|
const {
|
|
|
|
meetingId,
|
|
|
|
requesterUserId,
|
|
|
|
} = credentials;
|
|
|
|
|
2017-07-14 04:21:27 +08:00
|
|
|
Logger.info(`Publishing Breakouts2x for ${meetingId} ${requesterUserId}`);
|
|
|
|
|
2017-06-27 02:00:28 +08:00
|
|
|
return Breakouts.find({
|
|
|
|
$or: [
|
2017-08-12 04:17:35 +08:00
|
|
|
{ breakoutId: meetingId },
|
|
|
|
{ meetingId },
|
2017-06-27 02:00:28 +08:00
|
|
|
{
|
|
|
|
users: {
|
|
|
|
$elemMatch: { userId: requesterUserId },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function publish(...args) {
|
|
|
|
const boundBreakouts = breakouts.bind(this);
|
|
|
|
return mapToAcl('subscriptions.breakouts', boundBreakouts)(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
Meteor.publish('breakouts2x', publish);
|