diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-02-27 17:10:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-27 17:10:51 +0800 |
commit | eedb8f41297c343d6073a7bab46e4df6ee297a90 (patch) | |
tree | cb6cd673a33da5bea2ee4fdb392e6ac499cda6ca /models | |
parent | bad4ad70181c747599e206c0e7a87b57c997385d (diff) | |
download | gitea-eedb8f41297c343d6073a7bab46e4df6ee297a90.tar.gz gitea-eedb8f41297c343d6073a7bab46e4df6ee297a90.zip |
Only use supported sort order for "explore/users" page (#29430)
Thanks to inferenceus : some sort orders on the "explore/users" page
could list users by their lastlogintime/updatetime.
It leaks user's activity unintentionally. This PR makes that page only
use "supported" sort orders.
Removing the "sort orders" could also be a good solution, while IMO at
the moment keeping the "create time" and "name" orders is also fine, in
case some users would like to find a target user in the search result,
the "sort order" might help.
![image](https://github.com/go-gitea/gitea/assets/2114189/ce5c39c1-1e86-484a-80c3-33cac6419af8)
Diffstat (limited to 'models')
-rw-r--r-- | models/user/search.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/models/user/search.go b/models/user/search.go index 0fa278c257..9484bf4425 100644 --- a/models/user/search.go +++ b/models/user/search.go @@ -9,6 +9,7 @@ import ( "strings" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/modules/container" "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/util" @@ -30,6 +31,8 @@ type SearchUserOptions struct { Actor *User // The user doing the search SearchByEmail bool // Search by email as well as username/full name + SupportedSortOrders container.Set[string] // if not nil, only allow to use the sort orders in this set + IsActive util.OptionalBool IsAdmin util.OptionalBool IsRestricted util.OptionalBool |