mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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
This commit is contained in:
committed by
Harrison Healey
parent
1020081130
commit
12662d0c87
@@ -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()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user