mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
Added: Ability to delete org avatar.
This commit is contained in:
parent
c2ca103d30
commit
9c91e27933
5 changed files with 26 additions and 6 deletions
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue