mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-7684 Add support to outgoing webhooks and slash commands to set post type and props (#7531)
* Add support to outgoing webhooks and slash commands to set post type and props * Fix nil access
This commit is contained in:
committed by
Corey Hulen
parent
884cf494cb
commit
f263d2b951
@@ -305,6 +305,8 @@ func testCommand(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
rc := &model.CommandResponse{
|
||||
Text: "test command response " + msg,
|
||||
ResponseType: model.COMMAND_RESPONSE_TYPE_IN_CHANNEL,
|
||||
Type: "custom_test",
|
||||
Props: map[string]interface{}{"someprop": "somevalue"},
|
||||
}
|
||||
|
||||
w.Write([]byte(rc.ToJson()))
|
||||
|
||||
@@ -423,6 +423,14 @@ func TestExecuteCommand(t *testing.T) {
|
||||
cmdPosted := false
|
||||
for _, post := range posts.Posts {
|
||||
if strings.Contains(post.Message, "test command response") {
|
||||
if post.Type != "custom_test" {
|
||||
t.Fatal("wrong type set in slash command post")
|
||||
}
|
||||
|
||||
if post.Props["someprop"] != "somevalue" {
|
||||
t.Fatal("wrong prop set in slash command post")
|
||||
}
|
||||
|
||||
cmdPosted = true
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user