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

42 lines
889 B
JavaScript
Raw Normal View History

2017-07-01 03:16:00 +08:00
import Presentations from '/imports/api/2.0/presentations';
import Slides from '/imports/api/2.0/slides';
2017-06-23 01:24:00 +08:00
import Cursor from '/imports/api/2.0/cursor';
import Users from '/imports/api/2.0/users';
2016-11-12 03:02:46 +08:00
import Auth from '/imports/ui/services/auth';
const getCurrentPresentation = () => Presentations.findOne({
2017-07-25 02:46:53 +08:00
current: true,
2016-11-12 03:02:46 +08:00
});
const getCurrentSlide = () => {
const currentPresentation = getCurrentPresentation();
if (!currentPresentation) {
return null;
}
2016-11-12 03:02:46 +08:00
return Slides.findOne({
2017-07-25 02:46:53 +08:00
presentationId: currentPresentation.id,
2017-07-25 01:50:44 +08:00
current: true,
2016-11-12 03:02:46 +08:00
});
};
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
2017-07-26 22:09:07 +08:00
if (currentUser) {
return currentUser.presenter;
2016-11-22 23:46:08 +08:00
}
return false;
};
2016-11-12 03:02:46 +08:00
export default {
2016-11-12 03:02:46 +08:00
getCurrentPresentation,
getCurrentSlide,
getCurrentCursor,
isPresenter,
};