aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/admin
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-22 23:21:55 +0800
committerGitHub <noreply@github.com>2021-11-22 23:21:55 +0800
commitbaed01f24753afb600a2984dcb9bcda0bb8502b6 (patch)
tree5621ef980b6b0067a21c86be7e4808d83c0538ab /routers/web/admin
parentc2ab19888f92fbdec4276a16d224e8de80d1d1dd (diff)
downloadgitea-baed01f24753afb600a2984dcb9bcda0bb8502b6.tar.gz
gitea-baed01f24753afb600a2984dcb9bcda0bb8502b6.zip
Remove unnecessary attributes of User struct (#17745)
* Remove unnecessary functions of User struct * Move more database methods out of user struct * Move more database methods out of user struct * Fix template failure * Fix bug * Remove finished FIXME * remove unnecessary code
Diffstat (limited to 'routers/web/admin')
-rw-r--r--routers/web/admin/users.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go
index b23e4cf39b..077cf02f15 100644
--- a/routers/web/admin/users.go
+++ b/routers/web/admin/users.go
@@ -23,10 +23,10 @@ import (
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/web/explore"
- router_user_setting "code.gitea.io/gitea/routers/web/user/setting"
+ user_setting "code.gitea.io/gitea/routers/web/user/setting"
"code.gitea.io/gitea/services/forms"
"code.gitea.io/gitea/services/mailer"
- "code.gitea.io/gitea/services/user"
+ user_service "code.gitea.io/gitea/services/user"
)
const (
@@ -309,7 +309,7 @@ func EditUserPost(ctx *context.Context) {
}
if len(form.UserName) != 0 && u.Name != form.UserName {
- if err := router_user_setting.HandleUsernameChange(ctx, u, form.UserName); err != nil {
+ if err := user_setting.HandleUsernameChange(ctx, u, form.UserName); err != nil {
ctx.Redirect(setting.AppSubURL + "/admin/users")
return
}
@@ -378,7 +378,7 @@ func DeleteUser(ctx *context.Context) {
return
}
- if err = user.DeleteUser(u); err != nil {
+ if err = user_service.DeleteUser(u); err != nil {
switch {
case models.IsErrUserOwnRepos(err):
ctx.Flash.Error(ctx.Tr("admin.users.still_own_repo"))
@@ -411,7 +411,7 @@ func AvatarPost(ctx *context.Context) {
}
form := web.GetForm(ctx).(*forms.AvatarForm)
- if err := router_user_setting.UpdateAvatarSetting(ctx, form, u); err != nil {
+ if err := user_setting.UpdateAvatarSetting(ctx, form, u); err != nil {
ctx.Flash.Error(err.Error())
} else {
ctx.Flash.Success(ctx.Tr("settings.update_user_avatar_success"))
@@ -427,7 +427,7 @@ func DeleteAvatar(ctx *context.Context) {
return
}
- if err := u.DeleteAvatar(); err != nil {
+ if err := user_service.DeleteAvatar(u); err != nil {
ctx.Flash.Error(err.Error())
}