bigbluebutton-Github/bigbluebutton-html5/server/methods/publishSwitchToPreviousSlideMessage.js

36 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-04-20 01:43:31 +08:00
Meteor.methods({
publishSwitchToPreviousSlideMessage(meetingId, userId, authToken) {
let currentPresentationDoc, currentSlideDoc, message, previousSlideDoc;
currentPresentationDoc = Meteor.Presentations.findOne({
meetingId: meetingId,
'presentation.current': true,
});
if (currentPresentationDoc != null) {
currentSlideDoc = Meteor.Slides.findOne({
meetingId: meetingId,
presentationId: currentPresentationDoc.presentation.id,
'slide.current': true,
});
if (currentSlideDoc != null) {
previousSlideDoc = Meteor.Slides.findOne({
meetingId: meetingId,
presentationId: currentPresentationDoc.presentation.id,
'slide.num': currentSlideDoc.slide.num - 1,
});
if ((previousSlideDoc != null) && isAllowedTo('switchSlide', meetingId, userId, authToken)) {
message = {
payload: {
page: previousSlideDoc.slide.id,
meeting_id: meetingId,
},
header: {
name: 'go_to_slide',
},
};
return publish(Meteor.config.redis.channels.toBBBApps.presentation, message);
}
}
}
}
});