This commit is contained in:
2026-08-24 03:41:06 +02:00
parent a246ed8fe5
commit 8a690a0464
22 changed files with 1253 additions and 358 deletions
+25 -9
View File
@@ -440,7 +440,16 @@ func (s *Server) handleGetProduct(w http.ResponseWriter, r *http.Request) {
return
}
}
stripCatalogSEOMetaIfOmitted(processing.CompanyOmitsSEOMeta(r.Context(), s.Pool, cid), item)
// Deliberately NOT stripped here. The omit rule hides SEO meta from list views
// for cohorts that do not sell on it, but this payload feeds the review screen
// and meta the pipeline actually generated has to be reviewable.
//
// The cohort flag still travels, so the panel can say "disabled for this
// company" instead of "the AI generated nothing" — without it an empty block is
// unexplained, which is exactly what made SEO meta look missing.
if item != nil && processing.CompanyOmitsSEOMeta(r.Context(), s.Pool, cid) {
item["seo_meta_omitted"] = true
}
JSON(w, http.StatusOK, item)
}
@@ -467,6 +476,12 @@ func (s *Server) handleUpdateProduct(w http.ResponseWriter, r *http.Request) {
// stripCatalogSEOMetaIfOmitted drops meta_title / meta_description from dashboard
// product payloads when omit is true (same detection as V1 process / CompanyOmitsSEOMeta).
//
// Only EMPTY values are dropped. The omit cohort does not generate SEO meta, but
// rows enriched before that rule (or by an earlier pipeline) still carry it, and
// hiding stored copy from the dashboard meant Review could not show what the AI had
// actually produced. Generation still respects the cohort — this only stops the
// read path from concealing data that exists.
func stripCatalogSEOMetaIfOmitted(omit bool, items ...map[string]any) {
if !omit {
return
@@ -475,14 +490,15 @@ func stripCatalogSEOMetaIfOmitted(omit bool, items ...map[string]any) {
if item == nil {
continue
}
delete(item, "meta_title")
delete(item, "meta_description")
if loc, ok := item["localized_content"].(company.LocalizedContent); ok {
for lang, fields := range loc {
fields.MetaTitle = ""
fields.MetaDescription = ""
loc[lang] = fields
}
// Tell the client the cohort does not generate SEO meta, so an empty block
// reads as "disabled here" instead of "the AI produced nothing".
item["seo_meta_omitted"] = true
if asMapString(item["meta_title"]) == "" {
delete(item, "meta_title")
}
if asMapString(item["meta_description"]) == "" {
delete(item, "meta_description")
}
// Localized meta is left exactly as stored, for the same reason.
}
}