summaryrefslogtreecommitdiffstats
path: root/api/command.go
diff options
context:
space:
mode:
authorAsaad Mahmood <asaad@spinpunch.com>2016-03-08 15:07:43 +0500
committerAsaad Mahmood <asaad@spinpunch.com>2016-03-08 15:07:43 +0500
commitcc453a048d50e57802bab9363b59c2189143b784 (patch)
treecbd409ec59ad48c40b84337db9a4cf3a063e4915 /api/command.go
parent81ccfca2bfc91779d7bf00dbccb6f932d285a87c (diff)
downloadchat-cc453a048d50e57802bab9363b59c2189143b784.tar.gz
chat-cc453a048d50e57802bab9363b59c2189143b784.tar.bz2
chat-cc453a048d50e57802bab9363b59c2189143b784.zip
Multiple UI Improvements
Diffstat (limited to 'api/command.go')
-rw-r--r--api/command.go11
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 {