From a1c30740bb04ed55905415dcd195ee9fb97547de Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 2 Jan 2023 00:06:52 +0800 Subject: 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. --- models/avatars/avatar.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'models/avatars') 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 -- cgit v1.2.3