bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/service.js

51 lines
1.2 KiB
JavaScript
Raw Normal View History

import Presentations from '/imports/api/presentations';
import Shapes from '/imports/api/shapes';
import Slides from '/imports/api/slides';
2016-07-16 04:45:54 +08:00
import Cursor from '/imports/api/cursor';
2016-08-06 02:39:24 +08:00
import Users from '/imports/api/users';
import AuthSingleton from '/imports/ui/services/auth/index.js';
let getWhiteboardData = () => {
let currentSlide;
let shapes;
2016-07-16 04:45:54 +08:00
let cursor;
2016-08-06 02:39:24 +08:00
let userIsPresenter;
2016-06-25 05:30:37 +08:00
let currentPresentation = Presentations.findOne({
'presentation.current': true,
});
if (currentPresentation != null) {
currentSlide = Slides.findOne({
presentationId: currentPresentation.presentation.id,
'slide.current': true,
});
}
if (currentSlide != null) {
shapes = Shapes.find({
whiteboardId: currentSlide.slide.id,
}).fetch();
2016-07-16 04:45:54 +08:00
cursor = Cursor.findOne({
2016-07-16 04:45:54 +08:00
meetingId: currentSlide.meetingId,
});
2016-08-06 02:39:24 +08:00
// Get user to check if they are the presenter
userIsPresenter = Users.findOne({
meetingId: currentSlide.meetingId,
userId: AuthSingleton.getCredentials().requesterUserId,
}).user.presenter;
}
return {
currentSlide: currentSlide,
shapes: shapes,
2016-07-16 04:45:54 +08:00
cursor: cursor,
2016-08-06 02:39:24 +08:00
userIsPresenter: userIsPresenter,
};
};
export default {
getWhiteboardData,
};