1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Added: Ability to delete org avatar.

This commit is contained in:
Tamás Molnár
2016-03-06 17:36:30 +01:00
parent c2ca103d30
commit 9c91e27933
5 changed files with 26 additions and 6 deletions

View File

@@ -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")
}