diff options
author | Tamás Molnár <moltam@gmail.com> | 2016-03-06 17:36:30 +0100 |
---|---|---|
committer | Tamás Molnár <moltam@gmail.com> | 2016-03-06 17:36:30 +0100 |
commit | 9c91e279338f4d8bf09e1f7f5904d34cd525b102 (patch) | |
tree | 32882aa197724e0f75608c9bfd16a24650b7be22 /routers/user/setting.go | |
parent | c2ca103d30b0f47b5ad0fa544ab5a07263894ea3 (diff) | |
download | gitea-9c91e279338f4d8bf09e1f7f5904d34cd525b102.tar.gz gitea-9c91e279338f4d8bf09e1f7f5904d34cd525b102.zip |
Added: Ability to delete org avatar.
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") } |