Feat v0.2.7 user settings audit (#11)
Audit all 6 user settings sections. Remove dead chat-era code, rename localStorage namespace, clean up stale backend policies. - Remove BYOK nav section (empty BYOK_ITEMS, byokEnabled state, "BYOK Enabled" badge) and personas gate filter from settings nav - Remove auth.permissions.changed listener (existed solely for dead BYOK + personas state) - Remove Message Font Size slider, msgFont state, and --msg-font CSS variable application from appearance section and base template - Rename localStorage key cs-appearance → sb-appearance with one-time migration preserving existing user preferences - Remove allow_user_byok and allow_user_personas from PolicyDefaults, profile bootstrap, permissions handler, PublicSettings, and test seeds - Remove orphaned .settings-nav-footer CSS class - Replace stale policy-gating test assertions with allow_registration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -340,8 +340,6 @@ func TruncateAll(t *testing.T) {
|
||||
`)
|
||||
DB.Exec(`
|
||||
INSERT INTO platform_policies (key, value) VALUES
|
||||
('allow_user_byok', 'false'),
|
||||
('allow_user_personas', 'false'),
|
||||
('allow_registration', 'true'),
|
||||
('default_user_active', 'false'),
|
||||
('allow_team_providers', 'true')
|
||||
@@ -357,8 +355,6 @@ func TruncateAll(t *testing.T) {
|
||||
`)
|
||||
DB.Exec(`
|
||||
INSERT INTO platform_policies (key, value) VALUES
|
||||
('allow_user_byok', 'false'),
|
||||
('allow_user_personas', 'false'),
|
||||
('allow_registration', 'true'),
|
||||
('default_user_active', 'false'),
|
||||
('allow_team_providers', 'true')
|
||||
|
||||
@@ -369,7 +369,6 @@ func (h *AdminHandler) PublicSettings(c *gin.Context) {
|
||||
"storage_configured": storageConfigured,
|
||||
"policies": gin.H{
|
||||
"allow_registration": policies["allow_registration"],
|
||||
"allow_user_byok": policies["allow_user_byok"],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -83,10 +83,6 @@ func (h *ProfileBootstrapHandler) GetBootstrap(c *gin.Context) {
|
||||
|
||||
// ── Policies ────────────────────────────
|
||||
policies := make(map[string]bool)
|
||||
if ps := h.stores.Policies; ps != nil {
|
||||
policies["allow_user_byok"], _ = ps.GetBool(ctx, "allow_user_byok")
|
||||
policies["allow_user_personas"], _ = ps.GetBool(ctx, "allow_user_personas")
|
||||
}
|
||||
|
||||
// ── Settings ────────────────────────────
|
||||
settings := make(map[string]interface{})
|
||||
|
||||
@@ -64,10 +64,6 @@ func (h *ProfilePermissionsHandler) GetMyPermissions(c *gin.Context) {
|
||||
|
||||
// Policies that affect UI gating
|
||||
policies := make(map[string]bool)
|
||||
if ps := h.stores.Policies; ps != nil {
|
||||
policies["allow_user_byok"], _ = ps.GetBool(ctx, "allow_user_byok")
|
||||
policies["allow_user_personas"], _ = ps.GetBool(ctx, "allow_user_personas")
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"permissions": list,
|
||||
|
||||
@@ -84,10 +84,8 @@ type TeamMember struct {
|
||||
// PLATFORM POLICIES
|
||||
|
||||
var PolicyDefaults = map[string]string{
|
||||
"allow_user_byok": "false",
|
||||
"allow_user_personas": "false",
|
||||
"allow_registration": "true",
|
||||
"default_user_active": "false",
|
||||
"allow_registration": "true",
|
||||
"default_user_active": "false",
|
||||
"allow_team_providers": "true",
|
||||
}
|
||||
|
||||
|
||||
@@ -51,11 +51,11 @@
|
||||
if (fav) fav.href = fav.href.replace(/favicon(-light)?\.svg/, resolved === 'light' ? 'favicon-light.svg' : 'favicon.svg');
|
||||
} catch(e) {}
|
||||
})();
|
||||
// Early appearance — apply scale + msg font from localStorage on all surfaces.
|
||||
// Early appearance — apply scale from localStorage on all surfaces.
|
||||
// Scale uses transform on .surface-inner so shell stays fixed, content fills viewport.
|
||||
(function() {
|
||||
try {
|
||||
var p = JSON.parse(localStorage.getItem('cs-appearance') || '{}');
|
||||
var p = JSON.parse(localStorage.getItem('sb-appearance') || '{}');
|
||||
if (p.scale && p.scale !== 100) {
|
||||
var s = p.scale / 100;
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
@@ -63,7 +63,6 @@
|
||||
if (el) { el.style.transform = 'scale('+s+')'; el.style.transformOrigin = 'top left'; el.style.width = (100/s)+'%'; el.style.height = (100/s)+'%'; }
|
||||
});
|
||||
}
|
||||
if (p.msgFont && p.msgFont !== 14) document.documentElement.style.setProperty('--msg-font', p.msgFont + 'px');
|
||||
} catch(e) {}
|
||||
})();
|
||||
</script>
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
<script>
|
||||
(function() {
|
||||
try {
|
||||
var p = JSON.parse(localStorage.getItem('cs-appearance') || '{}');
|
||||
var p = JSON.parse(localStorage.getItem('sb-appearance') || '{}');
|
||||
var mode = p.theme || 'system';
|
||||
var resolved = mode;
|
||||
if (mode === 'system') resolved = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
|
||||
Reference in New Issue
Block a user