PLT-6931 Properly parse request body in post search (#6768)

* Properly parse request body in post search

* Update driver to use correct body
Этот коммит содержится в:
Joram Wilander
2017-06-28 10:28:17 -04:00
коммит произвёл Christopher Speller
родитель 3e9b5c2776
Коммит e527b6bbe4
2 изменённых файлов: 6 добавлений и 10 удалений

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

@@ -277,18 +277,14 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
props := model.MapFromJson(r.Body)
terms := props["terms"]
if len(terms) == 0 {
props := model.StringInterfaceFromJson(r.Body)
terms, ok := props["terms"].(string)
if !ok || len(terms) == 0 {
c.SetInvalidParam("terms")
return
}
isOrSearch := false
if val, ok := props["is_or_search"]; ok && val != "" {
isOrSearch, _ = strconv.ParseBool(val)
}
isOrSearch, _ := props["is_or_search"].(bool)
posts, err := app.SearchPostsInTeam(terms, c.Session.UserId, c.Params.TeamId, isOrSearch)
if err != nil {