Skip to content

Commit 32e8634

Browse files
authored
fix: update settings table on install (#22326)
Related to #22325 Signed-off-by: jolheiser <[email protected]>
1 parent efa7085 commit 32e8634

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
@@ -148,8 +148,8 @@ func Install(ctx *context.Context) {
148148

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

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

0 commit comments

Comments
 (0)