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
Этот коммит содержится в:
Zeger-Jan van de Weg
2017-01-09 15:25:02 +01:00
коммит произвёл Harrison Healey
родитель 1020081130
Коммит 12662d0c87
3 изменённых файлов: 69 добавлений и 55 удалений

Просмотреть файл

@@ -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()))
}