From 0c43f1ae68c77ca433acb6fea827110cbc3a8dc2 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 23 Aug 2024 19:22:37 +0300 Subject: [PATCH 1/2] Fix config updates --- plugins/admin/models/site.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/plugins/admin/models/site.go b/plugins/admin/models/site.go index 5b4dc3ee4..16aa7123c 100644 --- a/plugins/admin/models/site.go +++ b/plugins/admin/models/site.go @@ -62,18 +62,17 @@ func (t SiteModel) Init(cfg map[string]string) SiteModel { if db.CheckError(err, db.INSERT) { panic(err) } + } else { + if value != "" { + _, err := t.Table(t.TableName). + Where("key", "=", key).Update(dialect.H{ + "value": value, + }) + if db.CheckError(err, db.UPDATE) { + panic(err) + } + } } - //else { - // if value != "" { - // _, err := t.Table(t.TableName). - // Where("key", "=", key).Update(dialect.H{ - // "value": value, - // }) - // if db.CheckError(err, db.UPDATE) { - // panic(err) - // } - // } - //} } return t } From 7e6c2e12178bff4aafca0b1a0d4f857fb7ed938d Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 23 Aug 2024 19:27:32 +0300 Subject: [PATCH 2/2] Update site.go --- plugins/admin/models/site.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/admin/models/site.go b/plugins/admin/models/site.go index 16aa7123c..096f8d6d0 100644 --- a/plugins/admin/models/site.go +++ b/plugins/admin/models/site.go @@ -62,8 +62,7 @@ func (t SiteModel) Init(cfg map[string]string) SiteModel { if db.CheckError(err, db.INSERT) { panic(err) } - } else { - if value != "" { + } else if value != "" { _, err := t.Table(t.TableName). Where("key", "=", key).Update(dialect.H{ "value": value, @@ -72,7 +71,6 @@ func (t SiteModel) Init(cfg map[string]string) SiteModel { panic(err) } } - } } return t }