Remove server exception when user with expired session tries to join

This commit is contained in:
Tainan Felipe 2019-04-23 11:22:11 -03:00
parent 6014785ed0
commit 8cffe046ef

View File

@ -32,10 +32,10 @@ const HTML = document.getElementsByTagName('html')[0];
let breakoutNotified = false;
const propTypes = {
subscriptionsReady: PropTypes.bool.isRequired,
subscriptionsReady: PropTypes.bool,
locale: PropTypes.string,
approved: PropTypes.bool,
meetingHasEnded: PropTypes.bool.isRequired,
meetingHasEnded: PropTypes.bool,
meetingExist: PropTypes.bool,
};
@ -43,6 +43,8 @@ const defaultProps = {
locale: undefined,
approved: undefined,
meetingExist: false,
subscriptionsReady: false,
meetingHasEnded: false,
};
const fullscreenChangedEvents = [
@ -169,9 +171,17 @@ class Base extends Component {
meetingExist,
meetingHasEnded,
meetingIsBreakout,
loggedIn,
meetingExisted,
} = this.props;
if ((loading || !subscriptionsReady) && !meetingHasEnded && meetingExist) {
if (codeError && !meetingHasEnded) {
logger.error({ logCode: 'startup_client_usercouldnotlogin_error' }, `User could not log in HTML5, hit ${codeError}`);
return (<ErrorScreen code={codeError} />);
}
if (((loading || !subscriptionsReady) && !meetingHasEnded && meetingExist)
|| (!meetingExisted && !meetingExist && loggedIn)) {
return (<LoadingScreen>{loading}</LoadingScreen>);
}
@ -188,28 +198,19 @@ class Base extends Component {
return (<MeetingEnded code={codeError} />);
}
if (codeError && !meetingHasEnded) {
logger.error({ logCode: 'startup_client_usercouldnotlogin_error' }, `User could not log in HTML5, hit ${codeError}`);
return (<ErrorScreen code={codeError} />);
}
// this.props.annotationsHandler.stop();
return (<AppContainer {...this.props} baseControls={stateControls} />);
}
render() {
const { updateLoadingState } = this;
const { locale, meetingExist } = this.props;
const { locale } = this.props;
const stateControls = { updateLoadingState };
const { meetingExisted } = this.state;
return (
(!meetingExisted && !meetingExist && Auth.loggedIn)
? <LoadingScreen />
: (
<IntlStartup locale={locale} baseControls={stateControls}>
{this.renderByState()}
</IntlStartup>
)
<IntlStartup locale={locale} baseControls={stateControls}>
{this.renderByState()}
</IntlStartup>
);
}
}
@ -230,6 +231,8 @@ const BaseContainer = withTracker(() => {
let breakoutRoomSubscriptionHandler;
let meetingModeratorSubscriptionHandler;
if (Session.get('codeError')) return {};
const meeting = Meetings.findOne({ meetingId });
if (meeting) {
const { meetingEnded } = meeting;
@ -281,7 +284,6 @@ const BaseContainer = withTracker(() => {
userSubscriptionHandler = Meteor.subscribe('users', credentials, mappedUser.isModerator, subscriptionErrorHandler);
breakoutRoomSubscriptionHandler = Meteor.subscribe('breakouts', credentials, mappedUser.isModerator, subscriptionErrorHandler);
meetingModeratorSubscriptionHandler = Meteor.subscribe('meetings', credentials, mappedUser.isModerator, subscriptionErrorHandler);
}
const annotationsHandler = Meteor.subscribe('annotations', credentials, {
@ -367,6 +369,7 @@ const BaseContainer = withTracker(() => {
meetingExist: !!meeting,
meetingHasEnded: !!meeting && meeting.meetingEnded,
meetingIsBreakout: AppService.meetingIsBreakout(),
loggedIn,
};
})(Base);