move check for non presenter

This commit is contained in:
KDSBrowne 2018-11-01 15:53:34 +00:00
parent ecf0304a01
commit deac142296
2 changed files with 11 additions and 19 deletions

View File

@ -87,20 +87,11 @@ class Poll extends Component {
this.toggleCustomFields = this.toggleCustomFields.bind(this);
this.renderQuickPollBtns = this.renderQuickPollBtns.bind(this);
this.renderCustomView = this.renderCustomView.bind(this);
this.nonPresenterRedirect = this.nonPresenterRedirect.bind(this);
this.renderInputFields = this.renderInputFields.bind(this);
this.handleInputChange = this.handleInputChange.bind(this);
this.handleBackClick = this.handleBackClick.bind(this);
}
componentWillMount() {
this.nonPresenterRedirect();
}
componentDidUpdate() {
this.nonPresenterRedirect();
}
handleInputChange(index, event) {
// This regex will replace any instance of 2 or more consecutive white spaces
// with a single white space character.
@ -126,15 +117,6 @@ class Poll extends Component {
return items;
}
nonPresenterRedirect() {
const { currentUser } = this.props;
if (!currentUser.presenter) {
Session.set('isUserListOpen', true);
Session.set('forcePollOpen', false);
return Session.set('isPollOpen', false);
}
}
toggleCustomFields() {
const { customPollReq } = this.state;

View File

@ -1,13 +1,23 @@
import React from 'react';
import { makeCall } from '/imports/ui/services/api';
import { withTracker } from 'meteor/react-meteor-data';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import Presentations from '/imports/api/presentations';
import PresentationAreaService from '/imports/ui/components/presentation/service';
import Poll from './component';
import Service from './service';
const PollContainer = ({ ...props }) => <Poll {...props} />;
const PollContainer = ({ ...props }) => {
const currentUser = Users.findOne({ userId: Auth.userID });
if (currentUser.presenter) {
return (<Poll {...props} />);
}
Session.set('isPollOpen', false);
Session.set('forcePollOpen', false);
Session.set('isUserListOpen', true);
return null;
};
export default withTracker(({ }) => {
Meteor.subscribe('current-poll', Auth.meetingID);