MM-31711 - Implement cursor paging for threads (#16748)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bb7e5b6e9d
Коммит
13616cac0f
20
api4/user.go
20
api4/user.go
@@ -2855,7 +2855,8 @@ func getThreadsForUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
options := model.GetUserThreadsOpts{
|
||||
Since: 0,
|
||||
Page: 0,
|
||||
Before: "",
|
||||
After: "",
|
||||
PageSize: 30,
|
||||
Unread: false,
|
||||
Extended: false,
|
||||
@@ -2872,18 +2873,15 @@ func getThreadsForUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
options.Since = since
|
||||
}
|
||||
|
||||
pageString := r.URL.Query().Get("page")
|
||||
if pageString != "" {
|
||||
page, parseError := strconv.ParseUint(pageString, 10, 64)
|
||||
if parseError != nil {
|
||||
c.SetInvalidParam("page")
|
||||
return
|
||||
}
|
||||
options.Page = page
|
||||
options.Before = r.URL.Query().Get("before")
|
||||
options.After = r.URL.Query().Get("after")
|
||||
// parameters are mutually exclusive
|
||||
if options.Before != "" && options.After != "" {
|
||||
c.Err = model.NewAppError("api.getThreadsForUser", "api.getThreadsForUser.bad_params", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
pageSizeString := r.URL.Query().Get("pageSize")
|
||||
if pageString != "" {
|
||||
if pageSizeString != "" {
|
||||
pageSize, parseError := strconv.ParseUint(pageSizeString, 10, 64)
|
||||
if parseError != nil {
|
||||
c.SetInvalidParam("pageSize")
|
||||
|
||||
Ссылка в новой задаче
Block a user