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/org/setting.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'routers/web/org/setting.go') diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index f05dbd8bc1..7a6f4fec60 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -18,9 +18,10 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/web" - userSetting "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/org" + user_service "code.gitea.io/gitea/services/user" ) const ( @@ -136,7 +137,7 @@ func SettingsPost(ctx *context.Context) { func SettingsAvatar(ctx *context.Context) { form := web.GetForm(ctx).(*forms.AvatarForm) form.Source = forms.AvatarLocal - if err := userSetting.UpdateAvatarSetting(ctx, form, ctx.Org.Organization.AsUser()); err != nil { + if err := user_setting.UpdateAvatarSetting(ctx, form, ctx.Org.Organization.AsUser()); err != nil { ctx.Flash.Error(err.Error()) } else { ctx.Flash.Success(ctx.Tr("org.settings.update_avatar_success")) @@ -147,7 +148,7 @@ func SettingsAvatar(ctx *context.Context) { // SettingsDeleteAvatar response for delete avatar on settings page func SettingsDeleteAvatar(ctx *context.Context) { - if err := ctx.Org.Organization.AsUser().DeleteAvatar(); err != nil { + if err := user_service.DeleteAvatar(ctx.Org.Organization.AsUser()); err != nil { ctx.Flash.Error(err.Error()) } -- cgit v1.2.3