mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-21 01:10:19 +00:00
Move user related model into models/user (#17781)
* Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
This commit is contained in:
parent
4e7ca946da
commit
a666829a37
345 changed files with 4230 additions and 3813 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
"code.gitea.io/gitea/routers/api/v1/utils"
|
||||
|
@ -54,11 +55,11 @@ func Search(ctx *context.APIContext) {
|
|||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
users, maxResults, err := models.SearchUsers(&models.SearchUserOptions{
|
||||
users, maxResults, err := user_model.SearchUsers(&user_model.SearchUserOptions{
|
||||
Actor: ctx.User,
|
||||
Keyword: ctx.FormTrim("q"),
|
||||
UID: ctx.FormInt64("uid"),
|
||||
Type: models.UserTypeIndividual,
|
||||
Type: user_model.UserTypeIndividual,
|
||||
ListOptions: listOptions,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -105,7 +106,7 @@ func GetInfo(ctx *context.APIContext) {
|
|||
|
||||
if !models.IsUserVisibleToViewer(u, ctx.User) {
|
||||
// fake ErrUserNotExist error message to not leak information about existence
|
||||
ctx.NotFound("GetUserByName", models.ErrUserNotExist{Name: ctx.Params(":username")})
|
||||
ctx.NotFound("GetUserByName", user_model.ErrUserNotExist{Name: ctx.Params(":username")})
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.User))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue