summaryrefslogtreecommitdiffstats
path: root/app/command.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/command.go')
-rw-r--r--app/command.go24
1 files changed, 22 insertions, 2 deletions
diff --git a/app/command.go b/app/command.go
index dc65de6e2..4c26eae71 100644
--- a/app/command.go
+++ b/app/command.go
@@ -75,6 +75,13 @@ func (a *App) ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([
}
}
+ for _, cmd := range a.PluginCommandsForTeam(teamId) {
+ if cmd.AutoComplete && !seen[cmd.Trigger] {
+ seen[cmd.Trigger] = true
+ commands = append(commands, cmd)
+ }
+ }
+
if *a.Config().ServiceSettings.EnableCommands {
if result := <-a.Srv.Store.Command().GetByTeam(teamId); result.Err != nil {
return nil, result.Err
@@ -111,7 +118,7 @@ func (a *App) ListAllCommands(teamId string, T goi18n.TranslateFunc) ([]*model.C
for _, value := range commandProviders {
if cmd := value.GetCommand(a, T); cmd != nil {
cpy := *cmd
- if cpy.AutoComplete && !seen[cpy.Id] {
+ if cpy.AutoComplete && !seen[cpy.Trigger] {
cpy.Sanitize()
seen[cpy.Trigger] = true
commands = append(commands, &cpy)
@@ -119,13 +126,20 @@ func (a *App) ListAllCommands(teamId string, T goi18n.TranslateFunc) ([]*model.C
}
}
+ for _, cmd := range a.PluginCommandsForTeam(teamId) {
+ if !seen[cmd.Trigger] {
+ seen[cmd.Trigger] = true
+ commands = append(commands, cmd)
+ }
+ }
+
if *a.Config().ServiceSettings.EnableCommands {
if result := <-a.Srv.Store.Command().GetByTeam(teamId); result.Err != nil {
return nil, result.Err
} else {
teamCmds := result.Data.([]*model.Command)
for _, cmd := range teamCmds {
- if !seen[cmd.Id] {
+ if !seen[cmd.Trigger] {
cmd.Sanitize()
seen[cmd.Trigger] = true
commands = append(commands, cmd)
@@ -151,6 +165,12 @@ func (a *App) ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *
}
}
+ if cmd, response, err := a.ExecutePluginCommand(args); err != nil {
+ return nil, err
+ } else if cmd != nil {
+ return a.HandleCommandResponse(cmd, args, response, true)
+ }
+
if !*a.Config().ServiceSettings.EnableCommands {
return nil, model.NewAppError("ExecuteCommand", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
}