whiteboard toolbar component isPresenter rework

This commit is contained in:
Ramón Souza 2021-11-23 14:51:41 +00:00
parent d6f160d00f
commit cb04e0b74c
3 changed files with 6 additions and 14 deletions

View File

@ -694,13 +694,14 @@ class Presentation extends PureComponent {
}
renderWhiteboardToolbar(svgDimensions) {
const { currentSlide } = this.props;
const { currentSlide, userIsPresenter } = this.props;
if (!this.isPresentationAccessible()) return null;
return (
<WhiteboardToolbarContainer
whiteboardId={currentSlide.id}
height={svgDimensions.height}
isPresenter={userIsPresenter}
/>
);
}

View File

@ -9,7 +9,7 @@ const WhiteboardToolbarContainer = props => (
);
export default withTracker((params) => {
const { whiteboardId } = params;
const { whiteboardId, isPresenter } = params;
const data = {
actions: {
@ -31,8 +31,8 @@ export default withTracker((params) => {
},
textShapeActiveId: WhiteboardToolbarService.getTextShapeActiveId(),
multiUser: WhiteboardService.isMultiUserActive(whiteboardId),
isPresenter: WhiteboardToolbarService.isPresenter(),
annotations: WhiteboardToolbarService.filterAnnotationList(),
isPresenter,
annotations: WhiteboardToolbarService.filterAnnotationList(isPresenter),
isMeteorConnected: Meteor.status().connected,
multiUserSize: WhiteboardService.getMultiUserSize(whiteboardId),
};

View File

@ -1,7 +1,5 @@
import { makeCall } from '/imports/ui/services/api';
import Storage from '/imports/ui/services/storage/session';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import getFromUserSettings from '/imports/ui/services/users-settings';
const DRAW_SETTINGS = 'drawSettings';
@ -72,14 +70,8 @@ const getTextShapeActiveId = () => {
return drawSettings ? drawSettings.textShape.textShapeActiveId : '';
};
const isPresenter = () => {
const currentUser = Users.findOne({ userId: Auth.userID }, { fields: { presenter: 1 } });
return currentUser ? currentUser.presenter : false;
};
const filterAnnotationList = () => {
const filterAnnotationList = (amIPresenter) => {
const multiUserPenOnly = getFromUserSettings('bbb_multi_user_pen_only', WHITEBOARD_TOOLBAR.multiUserPenOnly);
const amIPresenter = isPresenter();
let filteredAnnotationList = WHITEBOARD_TOOLBAR.tools;
@ -120,6 +112,5 @@ export default {
setColor,
setTextShapeObject,
getTextShapeActiveId,
isPresenter,
filterAnnotationList,
};