aboutsummaryrefslogtreecommitdiffstats
path: root/models/system
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2023-01-17 23:00:19 +0800
committerGitHub <noreply@github.com>2023-01-17 17:00:19 +0200
commit21c91b7dff29107eeadfeec9ed6305fd43fa49b4 (patch)
treefaebdb46400280cefc02798b1b9db1e4ed59ed01 /models/system
parente763fab6851c278150a02c983e739a37e17ce988 (diff)
downloadgitea-21c91b7dff29107eeadfeec9ed6305fd43fa49b4.tar.gz
gitea-21c91b7dff29107eeadfeec9ed6305fd43fa49b4.zip
Set disable_gravatar/enable_federated_avatar when offline mode is true (#22479)
When offline mode is true, we should set `disable_gravatar` to `true` and `enable_federated_avatar` to `false` in system settings.
Diffstat (limited to 'models/system')
-rw-r--r--models/system/setting.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/system/setting.go b/models/system/setting.go
index 0701c4bf48..50fe17498e 100644
--- a/models/system/setting.go
+++ b/models/system/setting.go
@@ -268,6 +268,16 @@ func Init() error {
if setting_module.OfflineMode {
disableGravatar = true
enableFederatedAvatar = false
+ if !GetSettingBool(KeyPictureDisableGravatar) {
+ if err := SetSettingNoVersion(KeyPictureDisableGravatar, "true"); err != nil {
+ return fmt.Errorf("Failed to set setting %q: %w", KeyPictureDisableGravatar, err)
+ }
+ }
+ if GetSettingBool(KeyPictureEnableFederatedAvatar) {
+ if err := SetSettingNoVersion(KeyPictureEnableFederatedAvatar, "false"); err != nil {
+ return fmt.Errorf("Failed to set setting %q: %w", KeyPictureEnableFederatedAvatar, err)
+ }
+ }
}
if enableFederatedAvatar || !disableGravatar {