2016-10-28 01:47:40 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2017-06-01 01:54:43 +08:00
|
|
|
import mapToAcl from '/imports/startup/mapToAcl';
|
2017-10-12 10:00:28 +08:00
|
|
|
import Breakouts from '/imports/api/breakouts';
|
2017-10-12 05:25:18 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2016-10-28 01:47:40 +08:00
|
|
|
|
2017-06-01 01:54:43 +08:00
|
|
|
function breakouts(credentials) {
|
2016-11-25 03:22:04 +08:00
|
|
|
const {
|
|
|
|
meetingId,
|
|
|
|
requesterUserId,
|
|
|
|
} = credentials;
|
|
|
|
|
2017-10-13 03:07:02 +08:00
|
|
|
Logger.info(`Publishing Breakouts for ${meetingId} ${requesterUserId}`);
|
2017-10-12 05:25:18 +08:00
|
|
|
|
2018-06-07 05:24:09 +08:00
|
|
|
const selector = {
|
2018-06-07 06:18:27 +08:00
|
|
|
$or: [{
|
|
|
|
parentMeetingId: meetingId,
|
|
|
|
'users.userId': requesterUserId,
|
|
|
|
}, {
|
|
|
|
breakoutId: meetingId,
|
|
|
|
},
|
|
|
|
],
|
2018-06-07 05:24:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return Breakouts.find(selector);
|
2017-06-06 03:12:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function publish(...args) {
|
|
|
|
const boundBreakouts = breakouts.bind(this);
|
|
|
|
return mapToAcl('subscriptions.breakouts', boundBreakouts)(args);
|
|
|
|
}
|
|
|
|
|
2017-10-13 03:07:02 +08:00
|
|
|
Meteor.publish('breakouts', publish);
|