Support for interactive menus in message attachments (#9285)

Этот коммит содержится в:
Joram Wilander
2018-08-24 06:16:17 -04:00
коммит произвёл George Goldberg
родитель 9599f1a52f
Коммит 4de2e5206e
4 изменённых файлов: 89 добавлений и 8 удалений

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

@@ -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")