Skip to content

Commit 55c6433

Browse files
authored
fix: update settings table on install (#22326) (#22327)
Backport #22326 Signed-off-by: jolheiser <john.olheiser@gmail.com>
1 parent 5b87634 commit 55c6433

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

routers/install/install.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ func Install(ctx *context.Context) {
149149

150150
// Server and other services settings
151151
form.OfflineMode = setting.OfflineMode
152-
form.DisableGravatar = false // when installing, there is no database connection so that given a default value
153-
form.EnableFederatedAvatar = false // when installing, there is no database connection so that given a default value
152+
form.DisableGravatar = setting.DisableGravatar // when installing, there is no database connection so that given a default value
153+
form.EnableFederatedAvatar = setting.EnableFederatedAvatar // when installing, there is no database connection so that given a default value
154154

155155
form.EnableOpenIDSignIn = setting.Service.EnableOpenIDSignIn
156156
form.EnableOpenIDSignUp = setting.Service.EnableOpenIDSignUp
@@ -443,10 +443,13 @@ func SubmitInstall(ctx *context.Context) {
443443
cfg.Section("server").Key("OFFLINE_MODE").SetValue(fmt.Sprint(form.OfflineMode))
444444
// if you are reinstalling, this maybe not right because of missing version
445445
if err := system_model.SetSettingNoVersion(system_model.KeyPictureDisableGravatar, strconv.FormatBool(form.DisableGravatar)); err != nil {
446-
ctx.RenderWithErr(ctx.Tr("install.secret_key_failed", err), tplInstall, &form)
446+
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
447+
return
448+
}
449+
if err := system_model.SetSettingNoVersion(system_model.KeyPictureEnableFederatedAvatar, strconv.FormatBool(form.EnableFederatedAvatar)); err != nil {
450+
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
447451
return
448452
}
449-
cfg.Section("picture").Key("ENABLE_FEDERATED_AVATAR").SetValue(fmt.Sprint(form.EnableFederatedAvatar))
450453
cfg.Section("openid").Key("ENABLE_OPENID_SIGNIN").SetValue(fmt.Sprint(form.EnableOpenIDSignIn))
451454
cfg.Section("openid").Key("ENABLE_OPENID_SIGNUP").SetValue(fmt.Sprint(form.EnableOpenIDSignUp))
452455
cfg.Section("service").Key("DISABLE_REGISTRATION").SetValue(fmt.Sprint(form.DisableRegistration))

0 commit comments

Comments
 (0)