2019-08-01 03:10:41 +08:00
|
|
|
import { Slides, SlidePositions } from '/imports/api/slides';
|
2016-10-21 19:41:17 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2020-02-07 04:47:28 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2016-10-21 19:41:17 +08:00
|
|
|
|
2020-02-07 04:47:28 +08:00
|
|
|
function slides() {
|
|
|
|
if (!this.userId) {
|
|
|
|
return Slides.find({ meetingId: '' });
|
|
|
|
}
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
|
|
Logger.debug(`Publishing Slides for ${meetingId} ${requesterUserId}`);
|
2016-10-21 19:41:17 +08:00
|
|
|
|
2016-11-12 03:02:46 +08:00
|
|
|
return Slides.find({ meetingId });
|
2017-06-06 03:12:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function publish(...args) {
|
|
|
|
const boundSlides = slides.bind(this);
|
2018-11-06 03:30:37 +08:00
|
|
|
return boundSlides(...args);
|
2017-06-06 03:12:06 +08:00
|
|
|
}
|
|
|
|
|
2017-10-13 03:07:02 +08:00
|
|
|
Meteor.publish('slides', publish);
|
2019-08-01 03:10:41 +08:00
|
|
|
|
2020-02-07 04:47:28 +08:00
|
|
|
function slidePositions() {
|
|
|
|
if (!this.userId) {
|
|
|
|
return SlidePositions.find({ meetingId: '' });
|
|
|
|
}
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2019-08-01 03:10:41 +08:00
|
|
|
|
2020-02-07 04:47:28 +08:00
|
|
|
Logger.debug(`Publishing SlidePositions for ${meetingId} ${requesterUserId}`);
|
2019-08-01 03:10:41 +08:00
|
|
|
|
|
|
|
return SlidePositions.find({ meetingId });
|
|
|
|
}
|
|
|
|
|
|
|
|
function publishPositions(...args) {
|
|
|
|
const boundSlidePositions = slidePositions.bind(this);
|
|
|
|
return boundSlidePositions(...args);
|
|
|
|
}
|
|
|
|
|
|
|
|
Meteor.publish('slide-positions', publishPositions);
|