summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/api.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-11 15:03:30 +0800
committerGitHub <noreply@github.com>2021-11-11 15:03:30 +0800
commit90eb9fb889e5d3a5845576dbc63e3792f3da33f2 (patch)
tree4107df9dd446fe9a93e49cba1e59d0f721e70351 /routers/api/v1/api.go
parent492e1c2fbd1b646f4428207942a9f89b56f7b6a9 (diff)
downloadgitea-90eb9fb889e5d3a5845576dbc63e3792f3da33f2.tar.gz
gitea-90eb9fb889e5d3a5845576dbc63e3792f3da33f2.zip
Move EmailAddress & UserRedirect into models/user/ (#17607)
* Move EmailAddress into models/user/ * Fix test * rename user_mail to user_email * Fix test * Move UserRedirect into models/user/ * Fix lint & test * Fix lint * Fix lint * remove nolint comment * Fix lint
Diffstat (limited to 'routers/api/v1/api.go')
-rw-r--r--routers/api/v1/api.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 8f852a96ce..f312df23db 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -71,6 +71,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/unit"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
@@ -138,9 +139,9 @@ func repoAssignment() func(ctx *context.APIContext) {
owner, err = models.GetUserByName(userName)
if err != nil {
if models.IsErrUserNotExist(err) {
- if redirectUserID, err := models.LookupUserRedirect(userName); err == nil {
+ if redirectUserID, err := user_model.LookupUserRedirect(userName); err == nil {
context.RedirectToUser(ctx.Context, userName, redirectUserID)
- } else if models.IsErrUserRedirectNotExist(err) {
+ } else if user_model.IsErrUserRedirectNotExist(err) {
ctx.NotFound("GetUserByName", err)
} else {
ctx.Error(http.StatusInternalServerError, "LookupUserRedirect", err)
@@ -421,10 +422,10 @@ func orgAssignment(args ...bool) func(ctx *context.APIContext) {
ctx.Org.Organization, err = models.GetOrgByName(ctx.Params(":org"))
if err != nil {
if models.IsErrOrgNotExist(err) {
- redirectUserID, err := models.LookupUserRedirect(ctx.Params(":org"))
+ redirectUserID, err := user_model.LookupUserRedirect(ctx.Params(":org"))
if err == nil {
context.RedirectToUser(ctx.Context, ctx.Params(":org"), redirectUserID)
- } else if models.IsErrUserRedirectNotExist(err) {
+ } else if user_model.IsErrUserRedirectNotExist(err) {
ctx.NotFound("GetOrgByName", err)
} else {
ctx.Error(http.StatusInternalServerError, "LookupUserRedirect", err)