summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-08-24 06:16:17 -0400
committerGeorge Goldberg <george@gberg.me>2018-08-24 11:16:17 +0100
commit4de2e5206e23ee268b38f071ecd8fcbea0bbc80a (patch)
treebe3d191545afdfa91a861be69a04dd1f646a1e16 /app/post.go
parent9599f1a52fd4b2d029113b3ec56bd75453ae4d7b (diff)
downloadchat-4de2e5206e23ee268b38f071ecd8fcbea0bbc80a.tar.gz
chat-4de2e5206e23ee268b38f071ecd8fcbea0bbc80a.tar.bz2
chat-4de2e5206e23ee268b38f071ecd8fcbea0bbc80a.zip
Support for interactive menus in message attachments (#9285)
Diffstat (limited to 'app/post.go')
-rw-r--r--app/post.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/post.go b/app/post.go
index 0eed87280..fb0ef3f78 100644
--- a/app/post.go
+++ b/app/post.go
@@ -852,7 +852,7 @@ func makeOpenGraphURLsAbsolute(og *opengraph.OpenGraph, requestURL string) {
}
}
-func (a *App) DoPostAction(postId string, actionId string, userId string) *model.AppError {
+func (a *App) DoPostAction(postId, actionId, userId, selectedOption string) *model.AppError {
pchan := a.Srv.Store.Post().GetSingle(postId)
var post *model.Post
@@ -870,9 +870,15 @@ func (a *App) DoPostAction(postId string, actionId string, userId string) *model
request := &model.PostActionIntegrationRequest{
UserId: userId,
PostId: postId,
+ Type: action.Type,
Context: action.Integration.Context,
}
+ if action.Type == model.POST_ACTION_TYPE_SELECT {
+ request.DataSource = action.DataSource
+ request.Context["selected_option"] = selectedOption
+ }
+
req, _ := http.NewRequest("POST", action.Integration.URL, strings.NewReader(request.ToJson()))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")