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

50 lines
1.1 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';
2016-11-12 03:02:46 +08:00
import Auth from '/imports/ui/services/auth';
const getCurrentPresentation = () => Presentations.findOne({
'presentation.current': true,
});
const getCurrentSlide = () => {
const currentPresentation = getCurrentPresentation();
if (!currentPresentation) {
return null;
}
2016-11-12 03:02:46 +08:00
return Slides.findOne({
presentationId: currentPresentation.presentation.id,
'slide.current': true,
});
};
2016-07-16 04:45:54 +08:00
2016-11-12 03:02:46 +08:00
const getCurrentShapes = () => {
const currentSlide = getCurrentSlide();
2016-08-06 02:39:24 +08:00
2016-11-12 03:02:46 +08:00
if (!currentSlide) {
return null;
}
2016-11-12 03:02:46 +08:00
return Shapes.find({
whiteboardId: currentSlide.slide.id,
}).fetch();
};
2016-11-12 03:02:46 +08:00
const getCurrentCursor = () => Cursor.findOne({});
const isPresenter = () => Users.findOne({
userId: Auth.userID,
}).user.presenter;
export default {
2016-11-12 03:02:46 +08:00
getCurrentPresentation,
getCurrentSlide,
getCurrentShapes,
getCurrentCursor,
isPresenter,
};