Fix dashboard ignored system setting cache (#21621)

This is a performance regression from #18058

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
Lunny Xiao 2022-11-10 14:43:53 +08:00 committed by GitHub
parent ce5aafbc69
commit 385462d36c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 172 additions and 151 deletions

View file

@ -18,7 +18,6 @@ import (
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
system_module "code.gitea.io/gitea/modules/system"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/mailer"
@ -203,7 +202,11 @@ func ChangeConfig(ctx *context.Context) {
value := ctx.FormString("value")
version := ctx.FormInt("version")
if err := system_module.SetSetting(key, value, version); err != nil {
if err := system_model.SetSetting(&system_model.Setting{
SettingKey: key,
SettingValue: value,
Version: version,
}); err != nil {
log.Error("set setting failed: %v", err)
ctx.JSON(http.StatusOK, map[string]string{
"err": ctx.Tr("admin.config.set_setting_failed", key),