diff options
author | =Corey Hulen <corey@hulen.com> | 2016-03-07 17:12:47 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-03-07 17:12:47 -0800 |
commit | 8c3b4d0a4e8c8b5235f38fe74ed46c483057c691 (patch) | |
tree | 25cbdad296146b828c7502462dbf135563194848 /api | |
parent | b001507bedbc3c09fea2921b11e8825002f999cc (diff) | |
download | chat-8c3b4d0a4e8c8b5235f38fe74ed46c483057c691.tar.gz chat-8c3b4d0a4e8c8b5235f38fe74ed46c483057c691.tar.bz2 chat-8c3b4d0a4e8c8b5235f38fe74ed46c483057c691.zip |
PLT-2039 fixing slash builtin cmds showing as webhook
Diffstat (limited to 'api')
-rw-r--r-- | api/command.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/api/command.go b/api/command.go index bebe6629c..451de2c33 100644 --- a/api/command.go +++ b/api/command.go @@ -111,7 +111,7 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) { if provider != nil { response := provider.DoCommand(c, channelId, message) - handleResponse(c, w, response, channelId, provider.GetCommand(c)) + handleResponse(c, w, response, channelId, provider.GetCommand(c), true) return } else { chanChan := Srv.Store.Channel().Get(channelId) @@ -193,7 +193,7 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) { if response == nil { c.Err = model.NewLocAppError("command", "api.command.execute_command.failed_empty.app_error", map[string]interface{}{"Trigger": trigger}, "") } else { - handleResponse(c, w, response, channelId, cmd) + handleResponse(c, w, response, channelId, cmd, false) } } else { body, _ := ioutil.ReadAll(resp.Body) @@ -211,11 +211,14 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = model.NewLocAppError("command", "api.command.execute_command.not_found.app_error", map[string]interface{}{"Trigger": trigger}, "") } -func handleResponse(c *Context, w http.ResponseWriter, response *model.CommandResponse, channelId string, cmd *model.Command) { +func handleResponse(c *Context, w http.ResponseWriter, response *model.CommandResponse, channelId string, cmd *model.Command, builtIn bool) { post := &model.Post{} post.ChannelId = channelId - post.AddProp("from_webhook", "true") + + if !builtIn { + post.AddProp("from_webhook", "true") + } if utils.Cfg.ServiceSettings.EnablePostUsernameOverride { if len(cmd.Username) != 0 { |