2016-01-09 08:54:07 -06:00
|
|
|
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/mattermost/platform/model"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type LogoutProvider struct {
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-01 18:52:43 -08:00
|
|
|
const (
|
|
|
|
|
CMD_LOGOUT = "logout"
|
|
|
|
|
)
|
|
|
|
|
|
2016-01-09 08:54:07 -06:00
|
|
|
func init() {
|
|
|
|
|
RegisterCommandProvider(&LogoutProvider{})
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-01 18:52:43 -08:00
|
|
|
func (me *LogoutProvider) GetTrigger() string {
|
|
|
|
|
return CMD_LOGOUT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (me *LogoutProvider) GetCommand(c *Context) *model.Command {
|
2016-01-09 08:54:07 -06:00
|
|
|
return &model.Command{
|
2016-02-01 18:52:43 -08:00
|
|
|
Trigger: CMD_LOGOUT,
|
2016-01-09 08:54:07 -06:00
|
|
|
AutoComplete: true,
|
2016-02-01 18:52:43 -08:00
|
|
|
AutoCompleteDesc: c.T("api.command_logout.desc"),
|
2016-01-09 08:54:07 -06:00
|
|
|
AutoCompleteHint: "",
|
2016-02-01 18:52:43 -08:00
|
|
|
DisplayName: c.T("api.command_logout.name"),
|
2016-01-09 08:54:07 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (me *LogoutProvider) DoCommand(c *Context, channelId string, message string) *model.CommandResponse {
|
2016-03-07 17:16:56 -08:00
|
|
|
|
|
|
|
|
return &model.CommandResponse{GotoLocation: c.GetTeamURL() + "/logout", ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command_logout.success_message")}
|
2016-01-09 08:54:07 -06:00
|
|
|
}
|