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

61 lines
1.2 KiB
JavaScript
Raw Normal View History

import WhiteboardMultiUser from '/imports/api/2.0/whiteboard-multi-user/';
2017-07-01 03:16:00 +08:00
import Presentations from '/imports/api/2.0/presentations';
import Slides from '/imports/api/2.0/slides';
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;
}
return Slides.findOne(
{
presentationId: currentPresentation.id,
current: true,
},
{
fields: {
meetingId: 0,
thumbUri: 0,
swfUri: 0,
txtUri: 0,
svgUri: 0,
},
},
);
2016-11-12 03:02:46 +08:00
};
2016-07-16 04:45:54 +08:00
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
const getMultiUserStatus = () => {
const data = WhiteboardMultiUser.findOne({ meetingId: Auth.meetingID });
if (data) {
return data.multiUser;
}
return false;
};
export default {
2016-11-12 03:02:46 +08:00
getCurrentPresentation,
getCurrentSlide,
isPresenter,
getMultiUserStatus,
};