summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-03-30 09:30:33 -0400
committerChristopher Speller <crspeller@gmail.com>2016-03-30 09:30:33 -0400
commit29cc5e16bc397ddca4f7740eb6fa25dc74960d0d (patch)
treee9215d262f4a687ec172f195c81a93d059de97cc /webapp
parenta6a0f18166a29dd22525b690d8141961dbecdb9d (diff)
downloadchat-29cc5e16bc397ddca4f7740eb6fa25dc74960d0d.tar.gz
chat-29cc5e16bc397ddca4f7740eb6fa25dc74960d0d.tar.bz2
chat-29cc5e16bc397ddca4f7740eb6fa25dc74960d0d.zip
Resetting theme upon logout. Displaying loading page when logging in so user does not see their theme switch.
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/logged_in.jsx16
-rw-r--r--webapp/utils/utils.jsx4
2 files changed, 20 insertions, 0 deletions
diff --git a/webapp/components/logged_in.jsx b/webapp/components/logged_in.jsx
index 53db501bf..8aefceec7 100644
--- a/webapp/components/logged_in.jsx
+++ b/webapp/components/logged_in.jsx
@@ -14,6 +14,7 @@ const TutorialSteps = Constants.TutorialSteps;
const Preferences = Constants.Preferences;
import ErrorBar from 'components/error_bar.jsx';
import * as Websockets from 'action_creators/websocket_actions.jsx';
+import LoadingScreen from 'components/loading_screen.jsx';
import {browserHistory} from 'react-router';
@@ -44,6 +45,13 @@ export default class LoggedIn extends React.Component {
super(params);
this.onUserChanged = this.onUserChanged.bind(this);
+
+ this.state = {
+ user: null
+ };
+ }
+ isValidState() {
+ return this.state.user != null;
}
onUserChanged() {
// Grab the current user
@@ -75,6 +83,8 @@ export default class LoggedIn extends React.Component {
if (tutorialStep <= TutorialSteps.INTRO_SCREENS) {
browserHistory.push(Utils.getTeamURLFromAddressBar() + '/tutorial');
}
+
+ this.setState({user});
}
componentWillMount() {
// Emit view action
@@ -186,6 +196,8 @@ export default class LoggedIn extends React.Component {
Websockets.close();
UserStore.removeChangeListener(this.onUserChanged);
+ Utils.resetTheme();
+
$('body').off('click.userpopover');
$('body').off('mouseenter mouseleave', '.post');
$('body').off('mouseenter mouseleave', '.post.post--comment.same--root');
@@ -195,6 +207,10 @@ export default class LoggedIn extends React.Component {
$(window).off('keydown.preventBackspace');
}
render() {
+ if (!this.isValidState()) {
+ return <LoadingScreen/>;
+ }
+
let content = [];
if (this.props.children) {
content = this.props.children;
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 83519a6ec..3d1aa79a1 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -795,6 +795,10 @@ export function applyTheme(theme) {
updateCodeTheme(theme.codeTheme);
}
+export function resetTheme() {
+ applyTheme(Constants.THEMES.default);
+}
+
export function applyFont(fontName) {
const body = $('body');