aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2024-10-05 02:45:06 +0900
committerGitHub <noreply@github.com>2024-10-04 17:45:06 +0000
commit5d6d025c9b8d2abca9ec2bfdc795d1f0c1c6592d (patch)
treeae29b3ba5c7d498fa37308afc680c2fe68b15a91 /routers/api/v1
parent7e68bc88238104d2ee8b5a877fc1ad437f1778a4 (diff)
downloadgitea-5d6d025c9b8d2abca9ec2bfdc795d1f0c1c6592d.tar.gz
gitea-5d6d025c9b8d2abca9ec2bfdc795d1f0c1c6592d.zip
Add support for searching users by email (#30908)
Fix #30898 we have an option `SearchByEmail`, so enable it, then we can search user by email. Also added a test for it.
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/user/user.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index fedad87fc4..2c277a18c7 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -68,11 +68,12 @@ func Search(ctx *context.APIContext) {
users = []*user_model.User{user_model.NewActionsUser()}
default:
users, maxResults, err = user_model.SearchUsers(ctx, &user_model.SearchUserOptions{
- Actor: ctx.Doer,
- Keyword: ctx.FormTrim("q"),
- UID: uid,
- Type: user_model.UserTypeIndividual,
- ListOptions: listOptions,
+ Actor: ctx.Doer,
+ Keyword: ctx.FormTrim("q"),
+ UID: uid,
+ Type: user_model.UserTypeIndividual,
+ SearchByEmail: true,
+ ListOptions: listOptions,
})
if err != nil {
ctx.JSON(http.StatusInternalServerError, map[string]any{