Surface Slovenian A1 content in prompt page; purge English defaults
Three bugs hid the split A1 data behind English junk:
1. /api/auth/me company was only {id, name} — me.company.language never
existed, so the prompt/formula pages ALWAYS fell back to English as
the primary content language and never showed the Slovenian ("sl")
prompt sections by default. handleMe now enriches the active company
with language + content_languages from the companies table.
2. The unified prompt page injected English default texts: meta title /
meta description fields were pre-filled via getDefaultMetaTitle/
Description (and silently SAVED on Save), new description sections
started with English instructions, and type changes overwrote user
text with English defaults. All removed — empty stays empty
(placeholders only), stored tenant content is shown exactly as-is,
meta-only templates now save (sections no longer required).
3. Sync A1 / repair left English formula artifacts on categories with no
seed content ("Audio video" etc.): earlier repairs backfilled
DefaultRetailTitleFormula and cats.json-style English description
sections onto every category. Repair now (a) never invents a default
title formula — formulas derive ONLY from legacy naming rules — and
(b) with the seed as source of truth clears title_template and
description_template on non-seed categories (new
title/description_template_cleared counters).
Locally verified end-to-end: corrupted Platform Demo Monitorji (legacy
combined blob) + Audio video (English junk), called the real admin
POST /companies/{id}/sync-a1 as the platform admin — Monitorji restored
to the exact split Slovenian Title/Description/Meta + formulas +
Slovenian meta title/description, Audio video fully cleared; repair
idempotent (0 on re-run); me.company.language returns sl for A1;
zero English-default templates remain in A1 + Platform Demo.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -340,6 +340,24 @@ func (s *Server) handleMe(w http.ResponseWriter, r *http.Request) {
|
||||
out["company"] = c
|
||||
}
|
||||
}
|
||||
// Enrich with content language settings: the dashboard (category prompt /
|
||||
// formula pages, language switchers) reads me.company.language as the
|
||||
// primary content language — auth.Company alone is only {id, name},
|
||||
// which silently fell back to English for every tenant.
|
||||
if c, ok := out["company"].(auth.Company); ok {
|
||||
var lang string
|
||||
var contentLangs []string
|
||||
if err := s.Pool.QueryRow(r.Context(), `
|
||||
SELECT COALESCE(language, 'en'), COALESCE(content_languages, '{}')
|
||||
FROM companies WHERE id = $1`, cid).Scan(&lang, &contentLangs); err == nil {
|
||||
out["company"] = map[string]any{
|
||||
"id": c.ID,
|
||||
"name": c.Name,
|
||||
"language": lang,
|
||||
"content_languages": contentLangs,
|
||||
}
|
||||
}
|
||||
}
|
||||
if credits, err := s.Billing.CreditsOverview(r.Context(), cid, s.Config.LowCreditsThreshold); err == nil {
|
||||
out["credits"] = credits
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user