summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/command_logout.go2
-rw-r--r--i18n/en.json4
-rw-r--r--webapp/actions/global_actions.jsx22
-rw-r--r--webapp/components/create_post.jsx5
4 files changed, 19 insertions, 14 deletions
diff --git a/api/command_logout.go b/api/command_logout.go
index 474f0b58e..00375bb58 100644
--- a/api/command_logout.go
+++ b/api/command_logout.go
@@ -34,7 +34,7 @@ func (me *LogoutProvider) GetCommand(c *Context) *model.Command {
func (me *LogoutProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
FAIL := &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command_logout.fail_message")}
- SUCCESS := &model.CommandResponse{GotoLocation: "/", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command_logout.success_message")}
+ SUCCESS := &model.CommandResponse{GotoLocation: "/login"}
// We can't actually remove the user's cookie from here so we just dump their session and let the browser figure it out
if c.Session.Id != "" {
diff --git a/i18n/en.json b/i18n/en.json
index 1744f02b1..96961718e 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -572,10 +572,6 @@
"translation": "logout"
},
{
- "id": "api.command_logout.success_message",
- "translation": "Logging out..."
- },
- {
"id": "api.command_me.desc",
"translation": "Do an action"
},
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);
}