diff options
Diffstat (limited to 'routers/user/setting.go')
-rw-r--r-- | routers/user/setting.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/routers/user/setting.go b/routers/user/setting.go index 8d1b24dd8c..c704b67ce0 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "io/ioutil" - "os" "strings" "github.com/Unknwon/com" @@ -156,12 +155,10 @@ func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) { } func SettingsDeleteAvatar(ctx *middleware.Context) { - os.Remove(ctx.User.CustomAvatarPath()) - - ctx.User.UseCustomAvatar = false - if err := models.UpdateUser(ctx.User); err != nil { - ctx.Flash.Error(fmt.Sprintf("UpdateUser: %v", err)) + if err := ctx.User.DeleteAvatar(); err != nil { + ctx.Flash.Error(err.Error()) } + ctx.Redirect(setting.AppSubUrl + "/user/settings") } |