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

42 lines
950 B
JavaScript
Raw Normal View History

2017-06-19 19:57:32 +08:00
import Presentations from '/imports/api/1.1/presentations';
import Slides from '/imports/api/1.1/slides';
2017-06-23 01:24:00 +08:00
import Cursor from '/imports/api/2.0/cursor';
2017-06-19 19:57:32 +08:00
import Users from '/imports/api/1.1/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 getCurrentCursor = () => Cursor.findOne({});
2016-11-22 23:46:08 +08:00
const isPresenter = () => {
2017-06-03 03:25:02 +08:00
const currentUser = Users.findOne({ userId: Auth.userID });
2016-11-22 23:46:08 +08:00
if (currentUser && currentUser.user) {
return currentUser.user.presenter;
}
return false;
};
2016-11-12 03:02:46 +08:00
export default {
2016-11-12 03:02:46 +08:00
getCurrentPresentation,
getCurrentSlide,
getCurrentCursor,
isPresenter,
};