From baed01f24753afb600a2984dcb9bcda0bb8502b6 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 22 Nov 2021 23:21:55 +0800 Subject: 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 --- routers/web/admin/users.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'routers/web/admin/users.go') 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()) } -- cgit v1.2.3