diff --git a/bigbluebutton-html5/imports/api/slides/server/methods/switchSlide.js b/bigbluebutton-html5/imports/api/slides/server/methods/switchSlide.js index 3e57c7f2649d2619cc2cf56f1c1843a53dd3abcb..6a84da2153b8dd7df86ecbd1ba580e729efb8aba 100755 --- a/bigbluebutton-html5/imports/api/slides/server/methods/switchSlide.js +++ b/bigbluebutton-html5/imports/api/slides/server/methods/switchSlide.js @@ -4,46 +4,52 @@ import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; import RedisPubSub from '/imports/startup/server/redis'; import { extractCredentials } from '/imports/api/common/server/helpers'; +import Logger from '/imports/startup/server/logger'; export default function switchSlide(slideNumber, podId) { // TODO-- send presentationId and SlideId const REDIS_CONFIG = Meteor.settings.private.redis; - const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; const EVENT_NAME = 'SetCurrentPagePubMsg'; - const { meetingId, requesterUserId } = extractCredentials(this.userId); - - check(meetingId, String); - check(requesterUserId, String); - check(slideNumber, Number); - - const selector = { - meetingId, - podId, - current: true, - }; - const Presentation = Presentations.findOne(selector); - - if (!Presentation) { - throw new Meteor.Error('presentation-not-found', 'You need a presentation to be able to switch slides'); + try { + const { meetingId, requesterUserId } = extractCredentials(this.userId); + + check(meetingId, String); + check(requesterUserId, String); + check(slideNumber, Number); + check(podId, String); + + const selector = { + meetingId, + podId, + current: true, + }; + + const Presentation = Presentations.findOne(selector); + + if (!Presentation) { + throw new Meteor.Error('presentation-not-found', 'You need a presentation to be able to switch slides'); + } + + const Slide = Slides.findOne({ + meetingId, + podId, + presentationId: Presentation.id, + num: slideNumber, + }); + + if (!Slide) { + throw new Meteor.Error('slide-not-found', `Slide number ${slideNumber} not found in the current presentation`); + } + + const payload = { + podId, + presentationId: Presentation.id, + pageId: Slide.id, + }; + + RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); + } catch (err) { + Logger.error(`Exception while invoking method switchSlide ${err.stack}`); } - - const Slide = Slides.findOne({ - meetingId, - podId, - presentationId: Presentation.id, - num: slideNumber, - }); - - if (!Slide) { - throw new Meteor.Error('slide-not-found', `Slide number ${slideNumber} not found in the current presentation`); - } - - const payload = { - podId, - presentationId: Presentation.id, - pageId: Slide.id, - }; - - return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); } diff --git a/bigbluebutton-html5/imports/api/slides/server/methods/zoomSlide.js b/bigbluebutton-html5/imports/api/slides/server/methods/zoomSlide.js index 10b949fc5e9b7808c5e65ab1e8dbab1a3b48705d..3eea261b8e4d1df3ed2d4c3917e48c647c861ef9 100755 --- a/bigbluebutton-html5/imports/api/slides/server/methods/zoomSlide.js +++ b/bigbluebutton-html5/imports/api/slides/server/methods/zoomSlide.js @@ -4,48 +4,53 @@ import { Meteor } from 'meteor/meteor'; import RedisPubSub from '/imports/startup/server/redis'; import { extractCredentials } from '/imports/api/common/server/helpers'; import { check } from 'meteor/check'; +import Logger from '/imports/startup/server/logger'; -export default function zoomSlide(slideNumber, podId, widthRatio, heightRatio, x, y) { // TODO-- send presentationId and SlideId +export default function zoomSlide(slideNumber, podId, widthRatio, heightRatio, x, y) { const REDIS_CONFIG = Meteor.settings.private.redis; - const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; const EVENT_NAME = 'ResizeAndMovePagePubMsg'; - const { meetingId, requesterUserId } = extractCredentials(this.userId); - - check(meetingId, String); - check(requesterUserId, String); - const selector = { - meetingId, - podId, - current: true, - }; - const Presentation = Presentations.findOne(selector); - - if (!Presentation) { - throw new Meteor.Error('presentation-not-found', 'You need a presentation to be able to switch slides'); + try { + const { meetingId, requesterUserId } = extractCredentials(this.userId); + + check(meetingId, String); + check(requesterUserId, String); + + const selector = { + meetingId, + podId, + current: true, + }; + const Presentation = Presentations.findOne(selector); + + if (!Presentation) { + throw new Meteor.Error('presentation-not-found', 'You need a presentation to be able to switch slides'); + } + + const Slide = Slides.findOne({ + meetingId, + podId, + presentationId: Presentation.id, + num: slideNumber, + }); + + if (!Slide) { + throw new Meteor.Error('slide-not-found', `Slide number ${slideNumber} not found in the current presentation`); + } + + const payload = { + podId, + presentationId: Presentation.id, + pageId: Slide.id, + xOffset: x, + yOffset: y, + widthRatio, + heightRatio, + }; + + RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); + } catch (err) { + Logger.error(`Exception while invoking method zoomSlide ${err.stack}`); } - - const Slide = Slides.findOne({ - meetingId, - podId, - presentationId: Presentation.id, - num: slideNumber, - }); - - if (!Slide) { - throw new Meteor.Error('slide-not-found', `Slide number ${slideNumber} not found in the current presentation`); - } - - const payload = { - podId, - presentationId: Presentation.id, - pageId: Slide.id, - xOffset: x, - yOffset: y, - widthRatio, - heightRatio, - }; - - return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); }