fix: restore isCustom gate in metadata label resolvers (#21432)
## Context #21228 removed the stored `isCustom` column and, with it, the `isCustom` early-return in `resolveObjectMetadataStandardOverride` / `resolveFieldMetadataStandardOverride`, on the assumption that falling through the `standardOverrides` checks was equivalent. It isn't: custom object/field labels now reach the Lingui lookup. A custom label that collides with a standard catalog string (e.g. a custom field labeled "Status") gets translated for non-English locales against the user's intent, and every other custom label pays a hash + catalog miss — and, in production, an "Uncompiled message detected" warning (#21415) — on each metadata resolution. ## Fix Restore the gate. `isCustom` is no longer stored, so call sites that build the resolver input from flat entities (dataloader, minimal-metadata, view controller, command-menu-item navigation context) derive it via `belongsToTwentyStandardApp`; GraphQL resolvers keep passing DTOs, which already carry the derived value. ## Testing - Unit tests for both resolvers, including a new regression test: a custom label matching a standard catalog entry is returned verbatim, Lingui never called. --------- Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
+4
-1
@@ -78,12 +78,15 @@ export class MinimalMetadataService {
|
||||
.filter(isDefined)
|
||||
.filter((flatObjectMetadata) => flatObjectMetadata.isActive === true)
|
||||
.map((flatObjectMetadata) => {
|
||||
const isCustom = !belongsToTwentyStandardApp(flatObjectMetadata);
|
||||
|
||||
const objectMetadataForOverride = {
|
||||
labelPlural: flatObjectMetadata.labelPlural,
|
||||
labelSingular: flatObjectMetadata.labelSingular,
|
||||
description: flatObjectMetadata.description ?? undefined,
|
||||
icon: flatObjectMetadata.icon ?? undefined,
|
||||
color: flatObjectMetadata.color ?? undefined,
|
||||
isCustom,
|
||||
standardOverrides: flatObjectMetadata.standardOverrides ?? undefined,
|
||||
};
|
||||
|
||||
@@ -104,7 +107,7 @@ export class MinimalMetadataService {
|
||||
i18nInstance,
|
||||
),
|
||||
icon: flatObjectMetadata.icon ?? undefined,
|
||||
isCustom: !belongsToTwentyStandardApp(flatObjectMetadata),
|
||||
isCustom,
|
||||
isActive: flatObjectMetadata.isActive,
|
||||
isSystem: flatObjectMetadata.isSystem,
|
||||
isRemote: flatObjectMetadata.isRemote,
|
||||
|
||||
Reference in New Issue
Block a user