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 = { const propTypes = {
init: PropTypes.func.isRequired,
fontSize: PropTypes.string, fontSize: PropTypes.string,
navbar: PropTypes.element, navbar: PropTypes.element,
sidebar: PropTypes.element, sidebar: PropTypes.element,
@ -52,8 +51,6 @@ class App extends Component {
this.state = { this.state = {
compactUserList: false, //TODO: Change this on userlist resize (?) compactUserList: false, //TODO: Change this on userlist resize (?)
}; };
props.init.call(this);
} }
componentDidMount() { 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 { return {
init,
sidebar: getCaptionsStatus() ? <ClosedCaptionsContainer /> : null, sidebar: getCaptionsStatus() ? <ClosedCaptionsContainer /> : null,
fontSize: getFontSize(), fontSize: getFontSize(),
}; };

View File

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

View File

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