summaryrefslogtreecommitdiffstats
path: root/models/user/avatar.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/user/avatar.go')
-rw-r--r--models/user/avatar.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/models/user/avatar.go b/models/user/avatar.go
index 6a44a3bcb3..1c75c7406b 100644
--- a/models/user/avatar.go
+++ b/models/user/avatar.go
@@ -14,6 +14,7 @@ import (
"code.gitea.io/gitea/models/avatars"
"code.gitea.io/gitea/models/db"
+ system_model "code.gitea.io/gitea/models/system"
"code.gitea.io/gitea/modules/avatar"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
@@ -67,10 +68,16 @@ func (u *User) AvatarLinkWithSize(size int) string {
useLocalAvatar := false
autoGenerateAvatar := false
+ var disableGravatar bool
+ disableGravatarSetting, _ := system_model.GetSetting(system_model.KeyPictureDisableGravatar)
+ if disableGravatarSetting != nil {
+ disableGravatar = disableGravatarSetting.GetValueBool()
+ }
+
switch {
case u.UseCustomAvatar:
useLocalAvatar = true
- case setting.DisableGravatar, setting.OfflineMode:
+ case disableGravatar, setting.OfflineMode:
useLocalAvatar = true
autoGenerateAvatar = true
}