diff options
author | Otto Richter (fnetX) | 2022-03-01 20:21:37 +0100 |
---|---|---|
committer | GitHub | 2022-03-01 20:21:37 +0100 |
commit | aee0fa68a71f03b65460597af3f37a3f4c4a04dc (patch) | |
tree | fc4096620d7ace4e8466cae4efb44e2e8eac2146 | |
parent | 062fd4c217cc7302f56acf043d6214a9db46ee2f (diff) |
Fix admin user list pagination (#18957)
-rw-r--r-- | modules/context/pagination.go | 9 | ||||
-rw-r--r-- | routers/web/explore/user.go | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/modules/context/pagination.go b/modules/context/pagination.go index 107cbf618..140b67678 100644 --- a/modules/context/pagination.go +++ b/modules/context/pagination.go @@ -55,3 +55,12 @@ func (p *Pagination) SetDefaultParams(ctx *Context) { p.AddParam(ctx, "tab", "TabName") p.AddParam(ctx, "t", "queryType") } + +// SetUserFilterParams sets common pagination params for user filtering, e.g. the admin userlist +func (p *Pagination) SetUserFilterParams(ctx *Context) { + p.AddParamString("status_filter[is_active]", ctx.FormString("status_filter[is_active]")) + p.AddParamString("status_filter[is_admin]", ctx.FormString("status_filter[is_admin]")) + p.AddParamString("status_filter[is_restricted]", ctx.FormString("status_filter[is_restricted]")) + p.AddParamString("status_filter[is_2fa_enabled]", ctx.FormString("status_filter[is_2fa_enabled]")) + p.AddParamString("status_filter[is_prohibit_login]", ctx.FormString("status_filter[is_prohibit_login]")) +} diff --git a/routers/web/explore/user.go b/routers/web/explore/user.go index b264bf1b4..c3aa89e8e 100644 --- a/routers/web/explore/user.go +++ b/routers/web/explore/user.go @@ -82,6 +82,7 @@ func RenderUserSearch(ctx *context.Context, opts *user_model.SearchUserOptions, pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5) pager.SetDefaultParams(ctx) + pager.SetUserFilterParams(ctx) ctx.Data["Page"] = pager ctx.HTML(http.StatusOK, tplName) |