mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Remove session requirement from command args. * Removing unused server side translation. * Restoring model.CommandArgs.Session for compatibility. * Feedback fixes. * Build fix Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
40 lines
939 B
Go
40 lines
939 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package app
|
|
|
|
import (
|
|
goi18n "github.com/mattermost/go-i18n/i18n"
|
|
"github.com/mattermost/mattermost-server/v5/model"
|
|
)
|
|
|
|
type LogoutProvider struct {
|
|
}
|
|
|
|
const (
|
|
CMD_LOGOUT = "logout"
|
|
)
|
|
|
|
func init() {
|
|
RegisterCommandProvider(&LogoutProvider{})
|
|
}
|
|
|
|
func (me *LogoutProvider) GetTrigger() string {
|
|
return CMD_LOGOUT
|
|
}
|
|
|
|
func (me *LogoutProvider) GetCommand(a *App, T goi18n.TranslateFunc) *model.Command {
|
|
return &model.Command{
|
|
Trigger: CMD_LOGOUT,
|
|
AutoComplete: true,
|
|
AutoCompleteDesc: T("api.command_logout.desc"),
|
|
AutoCompleteHint: "",
|
|
DisplayName: T("api.command_logout.name"),
|
|
}
|
|
}
|
|
|
|
func (me *LogoutProvider) DoCommand(a *App, args *model.CommandArgs, message string) *model.CommandResponse {
|
|
// Actual logout is handled client side.
|
|
return &model.CommandResponse{GotoLocation: "/login"}
|
|
}
|