aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/org/setting.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-24 17:49:20 +0800
committerGitHub <noreply@github.com>2021-11-24 17:49:20 +0800
commita666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch)
tree9ab1434b759a8a2cb275a83149903a823851e309 /routers/web/org/setting.go
parent4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff)
downloadgitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.tar.gz
gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.zip
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
Diffstat (limited to 'routers/web/org/setting.go')
-rw-r--r--routers/web/org/setting.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go
index 7a6f4fec60..f0e1db14d0 100644
--- a/routers/web/org/setting.go
+++ b/routers/web/org/setting.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/models/webhook"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
@@ -61,7 +62,7 @@ func SettingsPost(ctx *context.Context) {
// Check if organization name has been changed.
if org.LowerName != strings.ToLower(form.Name) {
- isExist, err := models.IsUserExist(org.ID, form.Name)
+ isExist, err := user_model.IsUserExist(org.ID, form.Name)
if err != nil {
ctx.ServerError("IsUserExist", err)
return
@@ -69,8 +70,8 @@ func SettingsPost(ctx *context.Context) {
ctx.Data["OrgName"] = true
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), tplSettingsOptions, &form)
return
- } else if err = models.ChangeUserName(org.AsUser(), form.Name); err != nil {
- if err == models.ErrUserNameIllegal {
+ } else if err = user_model.ChangeUserName(org.AsUser(), form.Name); err != nil {
+ if err == user_model.ErrUserNameIllegal {
ctx.Data["OrgName"] = true
ctx.RenderWithErr(ctx.Tr("form.illegal_username"), tplSettingsOptions, &form)
} else {
@@ -101,7 +102,7 @@ func SettingsPost(ctx *context.Context) {
visibilityChanged := form.Visibility != org.Visibility
org.Visibility = form.Visibility
- if err := models.UpdateUser(org.AsUser()); err != nil {
+ if err := user_model.UpdateUser(org.AsUser()); err != nil {
ctx.ServerError("UpdateUser", err)
return
}