summaryrefslogtreecommitdiffstats
path: root/api4/post.go
diff options
context:
space:
mode:
Diffstat (limited to 'api4/post.go')
-rw-r--r--api4/post.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/api4/post.go b/api4/post.go
index b4edc5124..014174b37 100644
--- a/api4/post.go
+++ b/api4/post.go
@@ -333,17 +333,23 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) {
includeDeletedChannels := r.URL.Query().Get("include_deleted_channels") == "true"
props := model.StringInterfaceFromJson(r.Body)
+
terms, ok := props["terms"].(string)
if !ok || len(terms) == 0 {
c.SetInvalidParam("terms")
return
}
+ timeZoneOffset, ok := props["time_zone_offset"].(float64)
+ if !ok {
+ timeZoneOffset = 0
+ }
+
isOrSearch, _ := props["is_or_search"].(bool)
startTime := time.Now()
- results, err := c.App.SearchPostsInTeam(terms, c.Session.UserId, c.Params.TeamId, isOrSearch, includeDeletedChannels)
+ results, err := c.App.SearchPostsInTeam(terms, c.Session.UserId, c.Params.TeamId, isOrSearch, includeDeletedChannels, int(timeZoneOffset))
elapsedTime := float64(time.Since(startTime)) / float64(time.Second)
metrics := c.App.Metrics