fixed audio and settings modal reopening when changing locale in settings

This commit is contained in:
Matthew Marangoni 2017-05-03 14:39:07 -07:00
parent 02c6f6d80f
commit 99788090ee
4 changed files with 8 additions and 17 deletions

View File

@ -33,7 +33,6 @@ const intlMessages = defineMessages({
});
const propTypes = {
init: PropTypes.func.isRequired,
fontSize: PropTypes.string,
navbar: PropTypes.element,
sidebar: PropTypes.element,
@ -52,8 +51,6 @@ class App extends Component {
this.state = {
compactUserList: false, //TODO: Change this on userlist resize (?)
};
props.init.call(this);
}
componentDidMount() {

View File

@ -72,16 +72,7 @@ export default withRouter(injectIntl(withModalMounter(createContainer((
},
});
const APP_CONFIG = Meteor.settings.public.app;
const init = () => {
if (APP_CONFIG.autoJoinAudio) {
mountModal(<AudioModalContainer />);
}
};
return {
init,
sidebar: getCaptionsStatus() ? <ClosedCaptionsContainer /> : null,
fontSize: getFontSize(),
};

View File

@ -16,16 +16,17 @@ class AudioContainer extends Component {
}
}
let didMountedAutoJoin = false;
export default withModalMounter(createContainer(({ mountModal }) => {
const APP_CONFIG = Meteor.settings.public.app;
return {
init: () => {
Service.init();
if (APP_CONFIG.autoJoinAudio) {
mountModal(<AudioModal handleJoinListenOnly={Service.joinListenOnly} />);
}
if (didMountedAutoJoin) return;
mountModal(<AudioModal handleJoinListenOnly={Service.joinListenOnly} />);
didMountedAutoJoin = true;
},
};
}, AudioContainer));

View File

@ -2,6 +2,7 @@ import React, { Component } from 'react';
import Modal from '/imports/ui/components/modal/fullscreen/component';
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
import { defineMessages, injectIntl } from 'react-intl';
import { withModalMounter } from '../modal/service';
import ClosedCaptions from '/imports/ui/components/settings/submenus/closed-captions/component';
import Application from '/imports/ui/components/settings/submenus/application/container';
import Participants from '/imports/ui/components/settings/submenus/participants/component';
@ -105,6 +106,7 @@ class Settings extends Component {
title={intl.formatMessage(intlMessages.SettingsLabel)}
confirm={{
callback: (() => {
this.props.mountModal(null);
this.updateSettings(this.state.current);
}),
label: intl.formatMessage(intlMessages.SaveLabel),
@ -199,4 +201,4 @@ class Settings extends Component {
}
Settings.propTypes = propTypes;
export default injectIntl(Settings);
export default withModalMounter(injectIntl(Settings));