3
0

Remove obsolete settings (ns switcher, one)

This commit is contained in:
Denis Arh
2021-07-16 13:19:08 +02:00
parent b46dad70f5
commit b459bd3558
4 changed files with 39 additions and 46 deletions
@@ -0,0 +1,35 @@
package provision
import (
"context"
"github.com/cortezaproject/corteza-server/store"
"go.uber.org/zap"
)
func cleanupPre202109Settings(ctx context.Context, log *zap.Logger, s store.Storer) (err error) {
log.Info("cleaning up pre-2021.9 settings")
names := []string{
"compose.ui.namespace-switcher.enabled",
"compose.ui.namespace-switcher.default-open",
"messaging.message.attachments.enabled",
"messaging.message.attachments.max-size",
"messaging.message.attachments.mimetypes",
"messaging.message.attachments.source.camera.enabled",
"messaging.message.attachments.source.gallery.enabled",
"messaging.ui.browser-notifications.enabled",
"messaging.ui.browser-notifications.header",
"messaging.ui.browser-notifications.message-trim",
"messaging.ui.emoji.enabled",
"auth.external.session-store-secret",
"auth.external.session-store-secure",
}
for _, name := range names {
if err = store.DeleteSettingByNameOwnedBy(ctx, s, name, 0); err != nil {
return
}
}
return
}
+1
View File
@@ -30,6 +30,7 @@ func Run(ctx context.Context, log *zap.Logger, s store.Storer, provisionOpt opti
func() error { return migrateEmailTemplates(ctx, log.Named("email-templates"), s) },
func() error { return migratePre202106Roles(ctx, log.Named("pre-202106-roles"), s) },
func() error { return migratePre202106RbacRules(ctx, log.Named("pre-202106-rbac-rules"), s) },
func() error { return cleanupPre202109Settings(ctx, log.Named("pre-202106-rbac-rules"), s) },
// Config (full & partial)
func() error { return importConfig(ctx, log.Named("config"), s, provisionOpt.Path) },
-1
View File
@@ -1,5 +1,4 @@
settings:
compose.ui.namespace-switcher.enabled: false
compose.record.attachments.max-size: 10
compose.record.attachments.mimetypes: []
+3 -45
View File
@@ -109,57 +109,15 @@ type (
Mail struct {
FromAddress string `kv:"from-address"`
FromName string `kv:"from-name"`
EmailConfirmation struct {
Subject string `kv:"subject.en"`
Body string `kv:"body.en"`
} `kv:"email-confirmation"`
PasswordReset struct {
Subject string `kv:"subject.en"`
Body string `kv:"body.en"`
} `kv:"password-reset"`
} `json:"-"`
} `json:"-"`
UI struct {
// Corteza One configuration settings
One struct {
Logo string `kv:"logo" json:"logo"`
Title string `kv:"title" json:"title"`
PanelsEnabled bool `kv:"panels-enabled" json:"panelsEnabled"`
Panels []struct {
Visible bool `json:"visible"`
Sticky bool `json:"sticky"`
Width uint `json:"width"`
Height uint `json:"height"`
ActiveTabIndex uint `json:"activeTabIndex"`
Tabs []struct {
Title string `json:"title"`
Url string `json:"url"`
Logo string `json:"logo"`
Icon string `json:"icon"`
Sticky bool `json:"sticky"`
} `json:"tabs"`
} `kv:"panels,final" json:"panels"`
} `kv:"one" json:"one"`
// Admin struct {} `kv:"admin"`
} `kv:"ui" json:"ui"`
Compose struct {
// UI related settings
UI struct {
// Emoji
// @todo implementation
NamespaceSwitcher struct {
Enabled bool
DefaultOpen bool
} `kv:"namespace-switcher"`
} `kv:"ui"`
// (placeholder)
UI struct{} `kv:"ui"`
// Message related settings
// Record related settings
Record struct {
// @todo implementation
Attachments struct {