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

42 lines
935 B
JavaScript
Raw Normal View History

import Presentations from '/imports/api/presentations';
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 getCurrentCursor = () => Cursor.findOne({});
2016-11-22 23:46:08 +08:00
const isPresenter = () => {
const currentUser = Users.findOne({ userId: Auth.userID, });
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,
};