diff options
author | Otto Richter (fnetX) | 2022-03-02 00:00:03 +0100 |
---|---|---|
committer | GitHub | 2022-03-01 23:00:03 +0000 |
commit | 36e96e34815019103bb5905fece3fbf566fb0737 (patch) | |
tree | 51f4483fc7a34864065fe23b05a05d5627e9f188 | |
parent | a765410d0fb332b520aeca6456f785a2c8600c7e (diff) |
Fix admin user list pagination (#18957) (#18960)
-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 27634c3d4..1836df17b 100644 --- a/routers/web/explore/user.go +++ b/routers/web/explore/user.go @@ -84,6 +84,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) |