diff options
Diffstat (limited to 'routers/install/install.go')
-rw-r--r-- | routers/install/install.go | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/routers/install/install.go b/routers/install/install.go index 890725b9a7..8a0d34d976 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -12,12 +12,14 @@ import ( "os" "os/exec" "path/filepath" + "strconv" "strings" "time" "code.gitea.io/gitea/models/db" db_install "code.gitea.io/gitea/models/db/install" "code.gitea.io/gitea/models/migrations" + system_model "code.gitea.io/gitea/models/system" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" @@ -147,8 +149,19 @@ func Install(ctx *context.Context) { // Server and other services settings form.OfflineMode = setting.OfflineMode - form.DisableGravatar = setting.DisableGravatar - form.EnableFederatedAvatar = setting.EnableFederatedAvatar + disableGravatarSetting, _ := system_model.GetSetting(system_model.KeyPictureDisableGravatar) + if disableGravatarSetting != nil { + form.DisableGravatar = disableGravatarSetting.GetValueBool() + } else { + form.DisableGravatar = false + } + + enableFederatedAvatarSetting, _ := system_model.GetSetting(system_model.KeyPictureEnableFederatedAvatar) + if enableFederatedAvatarSetting != nil { + form.EnableFederatedAvatar = enableFederatedAvatarSetting.GetValueBool() + } else { + form.EnableFederatedAvatar = false + } form.EnableOpenIDSignIn = setting.Service.EnableOpenIDSignIn form.EnableOpenIDSignUp = setting.Service.EnableOpenIDSignUp form.DisableRegistration = setting.Service.DisableRegistration @@ -439,7 +452,11 @@ func SubmitInstall(ctx *context.Context) { cfg.Section("service").Key("ENABLE_NOTIFY_MAIL").SetValue(fmt.Sprint(form.MailNotify)) cfg.Section("server").Key("OFFLINE_MODE").SetValue(fmt.Sprint(form.OfflineMode)) - cfg.Section("picture").Key("DISABLE_GRAVATAR").SetValue(fmt.Sprint(form.DisableGravatar)) + // if you are reinstalling, this maybe not right because of missing version + if err := system_model.SetSettingNoVersion(system_model.KeyPictureDisableGravatar, strconv.FormatBool(form.DisableGravatar)); err != nil { + ctx.RenderWithErr(ctx.Tr("install.secret_key_failed", err), tplInstall, &form) + return + } cfg.Section("picture").Key("ENABLE_FEDERATED_AVATAR").SetValue(fmt.Sprint(form.EnableFederatedAvatar)) cfg.Section("openid").Key("ENABLE_OPENID_SIGNIN").SetValue(fmt.Sprint(form.EnableOpenIDSignIn)) cfg.Section("openid").Key("ENABLE_OPENID_SIGNUP").SetValue(fmt.Sprint(form.EnableOpenIDSignUp)) |