Clean up /logout command flow and errors (#4918)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
28a7a2f200
Коммит
2a91e5e031
@@ -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 {
|
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")}
|
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
|
// 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 != "" {
|
if c.Session.Id != "" {
|
||||||
|
|||||||
@@ -571,10 +571,6 @@
|
|||||||
"id": "api.command_logout.name",
|
"id": "api.command_logout.name",
|
||||||
"translation": "logout"
|
"translation": "logout"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "api.command_logout.success_message",
|
|
||||||
"translation": "Logging out..."
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "api.command_me.desc",
|
"id": "api.command_me.desc",
|
||||||
"translation": "Do an action"
|
"translation": "Do an action"
|
||||||
|
|||||||
@@ -476,15 +476,7 @@ export function emitUserLoggedOutEvent(redirectTo = '/', shouldSignalLogout = tr
|
|||||||
BrowserStore.signalLogout();
|
BrowserStore.signalLogout();
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserStore.clear();
|
clientLogout(redirectTo);
|
||||||
ErrorStore.clearLastError();
|
|
||||||
PreferenceStore.clear();
|
|
||||||
UserStore.clear();
|
|
||||||
TeamStore.clear();
|
|
||||||
newLocalizationSelected(global.window.mm_config.DefaultClientLocale);
|
|
||||||
stopPeriodicStatusUpdates();
|
|
||||||
WebsocketActions.close();
|
|
||||||
browserHistory.push(redirectTo);
|
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
browserHistory.push(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) {
|
export function emitSearchMentionsEvent(user) {
|
||||||
let terms = '';
|
let terms = '';
|
||||||
if (user.notify_props && user.notify_props.mention_keys) {
|
if (user.notify_props && user.notify_props.mention_keys) {
|
||||||
|
|||||||
@@ -125,6 +125,11 @@ export default class CreatePost extends React.Component {
|
|||||||
(data) => {
|
(data) => {
|
||||||
this.setState({submitting: false});
|
this.setState({submitting: false});
|
||||||
|
|
||||||
|
if (post.message.trim() === '/logout') {
|
||||||
|
GlobalActions.clientLogout(data.goto_location);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.goto_location && data.goto_location.length > 0) {
|
if (data.goto_location && data.goto_location.length > 0) {
|
||||||
browserHistory.push(data.goto_location);
|
browserHistory.push(data.goto_location);
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user