aboutsummaryrefslogtreecommitdiffstats
path: root/routers/user/setting/profile.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user/setting/profile.go')
-rw-r--r--routers/user/setting/profile.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/routers/user/setting/profile.go b/routers/user/setting/profile.go
index ac5c4c97fb..163bc869b4 100644
--- a/routers/user/setting/profile.go
+++ b/routers/user/setting/profile.go
@@ -141,13 +141,11 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *mo
if err = ctxUser.UploadAvatar(data); err != nil {
return fmt.Errorf("UploadAvatar: %v", err)
}
- } else {
+ } else if ctxUser.UseCustomAvatar && !com.IsFile(ctxUser.CustomAvatarPath()) {
// No avatar is uploaded but setting has been changed to enable,
// generate a random one when needed.
- if ctxUser.UseCustomAvatar && !com.IsFile(ctxUser.CustomAvatarPath()) {
- if err := ctxUser.GenerateRandomAvatar(); err != nil {
- log.Error("GenerateRandomAvatar[%d]: %v", ctxUser.ID, err)
- }
+ if err := ctxUser.GenerateRandomAvatar(); err != nil {
+ log.Error("GenerateRandomAvatar[%d]: %v", ctxUser.ID, err)
}
}