summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-12-30 13:12:43 -0500
committerChristopher Speller <crspeller@gmail.com>2016-12-30 13:12:43 -0500
commit2a91e5e031d9490f8364d55cb023d384d56f047f (patch)
tree9d32b19ae22122d67e2395a3361d9d89650b7c53 /webapp
parent28a7a2f200270ea64c7169403d79244babf5595b (diff)
downloadchat-2a91e5e031d9490f8364d55cb023d384d56f047f.tar.gz
chat-2a91e5e031d9490f8364d55cb023d384d56f047f.tar.bz2
chat-2a91e5e031d9490f8364d55cb023d384d56f047f.zip
Clean up /logout command flow and errors (#4918)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/global_actions.jsx22
-rw-r--r--webapp/components/create_post.jsx5
2 files changed, 18 insertions, 9 deletions
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx
index 5ee1e16a5..f1714def2 100644
--- a/webapp/actions/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -476,15 +476,7 @@ export function emitUserLoggedOutEvent(redirectTo = '/', shouldSignalLogout = tr
BrowserStore.signalLogout();
}
- BrowserStore.clear();
- ErrorStore.clearLastError();
- PreferenceStore.clear();
- UserStore.clear();
- TeamStore.clear();
- newLocalizationSelected(global.window.mm_config.DefaultClientLocale);
- stopPeriodicStatusUpdates();
- WebsocketActions.close();
- browserHistory.push(redirectTo);
+ clientLogout(redirectTo);
},
() => {
browserHistory.push(redirectTo);
@@ -492,6 +484,18 @@ export function emitUserLoggedOutEvent(redirectTo = '/', shouldSignalLogout = tr
);
}
+export function clientLogout(redirectTo = '/') {
+ BrowserStore.clear();
+ ErrorStore.clearLastError();
+ PreferenceStore.clear();
+ UserStore.clear();
+ TeamStore.clear();
+ newLocalizationSelected(global.window.mm_config.DefaultClientLocale);
+ stopPeriodicStatusUpdates();
+ WebsocketActions.close();
+ browserHistory.push(redirectTo);
+}
+
export function emitSearchMentionsEvent(user) {
let terms = '';
if (user.notify_props && user.notify_props.mention_keys) {
diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx
index 8e75b6070..13a8c729f 100644
--- a/webapp/components/create_post.jsx
+++ b/webapp/components/create_post.jsx
@@ -125,6 +125,11 @@ export default class CreatePost extends React.Component {
(data) => {
this.setState({submitting: false});
+ if (post.message.trim() === '/logout') {
+ GlobalActions.clientLogout(data.goto_location);
+ return;
+ }
+
if (data.goto_location && data.goto_location.length > 0) {
browserHistory.push(data.goto_location);
}