aboutsummaryrefslogtreecommitdiffstats
path: root/models/avatars
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-01-02 00:06:52 +0800
committerGitHub <noreply@github.com>2023-01-02 00:06:52 +0800
commita1c30740bb04ed55905415dcd195ee9fb97547de (patch)
tree60dd79afebadd9d092b84d790a1cf4678c4619d4 /models/avatars
parent0f4e1b9ac66b8ffa0083a5a2516e4710393bb0da (diff)
downloadgitea-a1c30740bb04ed55905415dcd195ee9fb97547de.tar.gz
gitea-a1c30740bb04ed55905415dcd195ee9fb97547de.zip
Fix get system setting bug when enabled redis cache (#22295)
Fix #22281 In #21621 , `Get[V]` and `Set[V]` has been introduced, so that cache value will be `*Setting`. For memory cache it's OK. But for redis cache, it can only store `string` for the current implementation. This PR revert some of changes of that and just store or return a `string` for system setting.
Diffstat (limited to 'models/avatars')
-rw-r--r--models/avatars/avatar.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/models/avatars/avatar.go b/models/avatars/avatar.go
index 7ccb782fa6..4386142861 100644
--- a/models/avatars/avatar.go
+++ b/models/avatars/avatar.go
@@ -153,8 +153,7 @@ func generateEmailAvatarLink(email string, size int, final bool) string {
return DefaultAvatarLink()
}
- enableFederatedAvatarSetting, _ := system_model.GetSetting(system_model.KeyPictureEnableFederatedAvatar)
- enableFederatedAvatar := enableFederatedAvatarSetting.GetValueBool()
+ enableFederatedAvatar := system_model.GetSettingBool(system_model.KeyPictureEnableFederatedAvatar)
var err error
if enableFederatedAvatar && system_model.LibravatarService != nil {
@@ -175,9 +174,7 @@ func generateEmailAvatarLink(email string, size int, final bool) string {
return urlStr
}
- disableGravatarSetting, _ := system_model.GetSetting(system_model.KeyPictureDisableGravatar)
-
- disableGravatar := disableGravatarSetting.GetValueBool()
+ disableGravatar := system_model.GetSettingBool(system_model.KeyPictureDisableGravatar)
if !disableGravatar {
// copy GravatarSourceURL, because we will modify its Path.
avatarURLCopy := *system_model.GravatarSourceURL