diff --git a/internal/bootstrap/data/setting.go b/internal/bootstrap/data/setting.go
index 8adc713d6d62..c6b771b45f3d 100644
--- a/internal/bootstrap/data/setting.go
+++ b/internal/bootstrap/data/setting.go
@@ -21,7 +21,6 @@ func initSettings() {
if err != nil {
utils.Log.Fatalf("failed get settings: %+v", err)
}
-
for i := range settings {
if !isActive(settings[i].Key) && settings[i].Flag != model.DEPRECATED {
settings[i].Flag = model.DEPRECATED
@@ -42,7 +41,7 @@ func initSettings() {
continue
}
// save
- if stored != nil && item.Key != conf.VERSION {
+ if stored != nil && item.Key != conf.VERSION && stored.Value != item.DeprecatedValue {
item.Value = stored.Value
}
if stored == nil || *item != *stored {
@@ -129,7 +128,7 @@ func InitialSettings() []model.SettingItem {
// global settings
{Key: conf.HideFiles, Value: "/\\/README.md/i", Type: conf.TypeText, Group: model.GLOBAL},
{Key: "package_download", Value: "true", Type: conf.TypeBool, Group: model.GLOBAL},
- {Key: conf.CustomizeHead, Value: ``, Type: conf.TypeText, Group: model.GLOBAL, Flag: model.PRIVATE},
+ {Key: conf.CustomizeHead, DeprecatedValue: ``, Type: conf.TypeText, Group: model.GLOBAL, Flag: model.PRIVATE},
{Key: conf.CustomizeBody, Type: conf.TypeText, Group: model.GLOBAL, Flag: model.PRIVATE},
{Key: conf.LinkExpiration, Value: "0", Type: conf.TypeNumber, Group: model.GLOBAL, Flag: model.PRIVATE},
{Key: conf.SignAll, Value: "true", Type: conf.TypeBool, Group: model.GLOBAL, Flag: model.PRIVATE},
diff --git a/internal/model/setting.go b/internal/model/setting.go
index 1a47cf5c062e..9ef6fdf7d783 100644
--- a/internal/model/setting.go
+++ b/internal/model/setting.go
@@ -21,13 +21,14 @@ const (
)
type SettingItem struct {
- Key string `json:"key" gorm:"primaryKey" binding:"required"` // unique key
- Value string `json:"value"` // value
- Help string `json:"help"` // help message
- Type string `json:"type"` // string, number, bool, select
- Options string `json:"options"` // values for select
- Group int `json:"group"` // use to group setting in frontend
- Flag int `json:"flag"` // 0 = public, 1 = private, 2 = readonly, 3 = deprecated, etc.
+ Key string `json:"key" gorm:"primaryKey" binding:"required"` // unique key
+ Value string `json:"value"` // value
+ DeprecatedValue string `json:"deprecated_value" gorm:"-:all"` // deprecated value
+ Help string `json:"help"` // help message
+ Type string `json:"type"` // string, number, bool, select
+ Options string `json:"options"` // values for select
+ Group int `json:"group"` // use to group setting in frontend
+ Flag int `json:"flag"` // 0 = public, 1 = private, 2 = readonly, 3 = deprecated, etc.
}
func (s SettingItem) IsDeprecated() bool {