From 12662d0c877b585c96d35b91fea4b6e99fcba749 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Mon, 9 Jan 2017 15:25:02 +0100 Subject: Slack format for Slash command messages (#4999) * Slash commands accept Slack format Until this commit the slash commands only accepted 'text' properties. For better styling however, Slack formatting support was added. However, ephemeral messages are not supported, and only text will be displayed. * Allow emphemeral Slack messages --- api/command.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'api/command.go') diff --git a/api/command.go b/api/command.go index 842d67843..9c8f60be5 100644 --- a/api/command.go +++ b/api/command.go @@ -134,7 +134,6 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) { return } else { team = tr.Data.(*model.Team) - } var user *model.User @@ -247,23 +246,7 @@ func handleResponse(c *Context, w http.ResponseWriter, response *model.CommandRe } } - if response.ResponseType == model.COMMAND_RESPONSE_TYPE_IN_CHANNEL { - post.Message = response.Text - post.UserId = c.Session.UserId - if _, err := CreatePost(c, post, true); err != nil { - c.Err = model.NewLocAppError("command", "api.command.execute_command.save.app_error", nil, "") - } - } else if response.ResponseType == model.COMMAND_RESPONSE_TYPE_EPHEMERAL && response.Text != "" { - post.Message = response.Text - post.CreateAt = model.GetMillis() - post.UserId = c.Session.UserId - post.ParentId = "" - SendEphemeralPost( - c.TeamId, - c.Session.UserId, - post, - ) - } + CreateCommandPost(c, post, response) w.Write([]byte(response.ToJson())) } -- cgit v1.2.3-1-g7c22