summaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/admin/users.go9
-rw-r--r--routers/web/explore/user.go4
2 files changed, 11 insertions, 2 deletions
diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go
index 4358db89ba..1f304297c0 100644
--- a/routers/web/admin/users.go
+++ b/routers/web/admin/users.go
@@ -41,10 +41,16 @@ func Users(ctx *context.Context) {
ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
+ extraParamStrings := map[string]string{}
statusFilterKeys := []string{"is_active", "is_admin", "is_restricted", "is_2fa_enabled", "is_prohibit_login"}
statusFilterMap := map[string]string{}
for _, filterKey := range statusFilterKeys {
- statusFilterMap[filterKey] = ctx.FormString("status_filter[" + filterKey + "]")
+ paramKey := "status_filter[" + filterKey + "]"
+ paramVal := ctx.FormString(paramKey)
+ statusFilterMap[filterKey] = paramVal
+ if paramVal != "" {
+ extraParamStrings[paramKey] = paramVal
+ }
}
sortType := ctx.FormString("sort")
@@ -68,6 +74,7 @@ func Users(ctx *context.Context) {
IsRestricted: util.OptionalBoolParse(statusFilterMap["is_restricted"]),
IsTwoFactorEnabled: util.OptionalBoolParse(statusFilterMap["is_2fa_enabled"]),
IsProhibitLogin: util.OptionalBoolParse(statusFilterMap["is_prohibit_login"]),
+ ExtraParamStrings: extraParamStrings,
}, tplUsers)
}
diff --git a/routers/web/explore/user.go b/routers/web/explore/user.go
index c3aa89e8e6..98788f5433 100644
--- a/routers/web/explore/user.go
+++ b/routers/web/explore/user.go
@@ -82,7 +82,9 @@ 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)
+ for paramKey, paramVal := range opts.ExtraParamStrings {
+ pager.AddParamString(paramKey, paramVal)
+ }
ctx.Data["Page"] = pager
ctx.HTML(http.StatusOK, tplName)