36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
|
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);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|