This commit is contained in:
greeneclipse committed 2026-10-14 20:28:38 +02:00
1 parent 8b540d22bc
commit c92ee93482
24 files changed
+1495 -327

No files matched your search

+5 -30
View File
@@ -8,7 +8,6 @@ import (
"regexp"
"strings"
"github.com/descrybe/descrybe-v2/apps/api/internal/billing"
"github.com/descrybe/descrybe-v2/apps/api/internal/catalog"
"github.com/descrybe/descrybe-v2/apps/api/internal/company"
"github.com/descrybe/descrybe-v2/apps/api/internal/eprel"
@@ -488,40 +487,16 @@ func nullIfEmptyPtr(s *string) any {
return *s
}
// Known v2 companies.id values that omit SEO meta on V1 process payloads.
// A1 Slovenija is also matched via billing.A1LegacyCompanyID (legacy_company_id / PK).
const (
a1V2CompanyID = "604f23a8-b66e-4b21-8b45-0d72b68f4790"
platformDemoV2CompanyID = "2b3159b0-fc08-415b-b248-35ed02a6baab"
)
// Only the Platform Demo company explicitly suppresses generated SEO meta.
// A1 now uses its category Meta formula like all production companies.
const platformDemoV2CompanyID = "2b3159b0-fc08-415b-b248-35ed02a6baab"
// CompanyOmitsSEOMetaID is true for A1 Slovenija and Platform Demo by companies.id
// (or the migrated MySQL company id). Does not grant Legacy plan privileges.
func CompanyOmitsSEOMetaID(companyID uuid.UUID) bool {
if companyID == uuid.Nil {
return false
}
id := strings.ToLower(companyID.String())
switch id {
case a1V2CompanyID, platformDemoV2CompanyID, strings.ToLower(billing.A1LegacyCompanyID):
return true
}
return false
return companyID != uuid.Nil && strings.EqualFold(companyID.String(), platformDemoV2CompanyID)
}
// CompanyOmitsSEOMetaLookup is the shared A1/Demo SEO-omit decision used by V1 process
// and catalog list/get/update. Matches hardcoded companies.id, A1 cohort (legacy id),
// or Platform Demo by name. Role-sectioned category prompts (--- Title --- / --- Meta ---)
// are the platform-wide canonical prompt shape now, so they no longer imply the A1
// cohort — sniffing them here made any tenant using the prompt editor lose SEO meta.
func CompanyOmitsSEOMetaLookup(companyID uuid.UUID, legacyID, name string) bool {
if CompanyOmitsSEOMetaID(companyID) {
return true
}
if billing.IsA1CohortCompany(legacyID, "") {
return true
}
return strings.EqualFold(strings.TrimSpace(name), "Platform Demo")
return CompanyOmitsSEOMetaID(companyID) || strings.EqualFold(strings.TrimSpace(name), "Platform Demo")
}
// CompanyOmitsSEOMeta is true when catalog/V1 process must omit meta_title /