feat: rename RICH_TEXT_V2 → RICH_TEXT in codebase (keep DB value) (#18628)
## Summary - Renames the `FieldMetadataType` enum key from `RICH_TEXT_V2` to `RICH_TEXT` across the entire codebase, while keeping the underlying string value as `'RICH_TEXT_V2'` to maintain PostgreSQL database compatibility - Renames all related types, guards, hooks, components, and files from `*RichTextV2*` / `*rich-text-v2*` to `*RichText*` / `*rich-text*` (e.g. `FormRichTextV2FieldInput` → `FormRichTextFieldInput`, `isFieldRichTextV2` → `isFieldRichText`) - Updates generated files (GraphQL schema, SDK types) to use the new key while preserving the `RICH_TEXT_V2` string value for DB/API layer - Updates i18n locale files, test snapshots, and integration tests to reflect the rename ## Context The legacy `RICH_TEXT` (V1) field type was deprecated and migrated to `TEXT` in a previous PR (#18623). With V1 gone, the `RICH_TEXT_V2` naming is no longer necessary — `RICH_TEXT` is now the canonical name. The DB enum value stays `'RICH_TEXT_V2'` to avoid confusion with the just-deprecated V1 type and to prevent a database migration. ## Test plan - [x] `twenty-server` typecheck passes - [x] `twenty-front` typecheck passes (only pre-existing Apollo client errors remain) - [x] `twenty-server` lint passes - [x] `twenty-front` lint passes - [x] `twenty-shared` build passes - [ ] CI passes Made with [Cursor](https://cursor.com)
This commit is contained in:
+1
-1
@@ -124,7 +124,7 @@ export const generateRandomFieldValue = ({
|
||||
return {};
|
||||
}
|
||||
|
||||
case FieldMetadataType.RICH_TEXT_V2: {
|
||||
case FieldMetadataType.RICH_TEXT: {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ export const generateFieldFilterZodSchema = (
|
||||
.describe(`Filter by ${field.name} (UUID field)`);
|
||||
|
||||
case FieldMetadataType.TEXT:
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
return z
|
||||
.object({
|
||||
eq: z.string().optional().describe('Equals'),
|
||||
|
||||
+1
-1
@@ -238,7 +238,7 @@ export const generateRecordPropertiesZodSchema = (
|
||||
});
|
||||
break;
|
||||
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
fieldSchema = z.object({
|
||||
markdown: z.string().optional(),
|
||||
blocknote: z.string().optional(),
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ import { isDefined } from 'twenty-shared/utils';
|
||||
import { transformEmailsValue } from 'src/engine/core-modules/record-transformer/utils/transform-emails-value.util';
|
||||
import { transformLinksValue } from 'src/engine/core-modules/record-transformer/utils/transform-links-value.util';
|
||||
import { transformPhonesValue } from 'src/engine/core-modules/record-transformer/utils/transform-phones-value.util';
|
||||
import { transformRichTextV2Value } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text-v2.util';
|
||||
import { transformRichTextValue } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text.util';
|
||||
import { FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
|
||||
import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util';
|
||||
import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';
|
||||
@@ -78,8 +78,8 @@ export class RecordInputTransformerService {
|
||||
return value || null;
|
||||
case FieldMetadataType.NUMBER:
|
||||
return value === null ? null : Number(value);
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
return await transformRichTextV2Value(value);
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
return await transformRichTextValue(value);
|
||||
case FieldMetadataType.LINKS:
|
||||
return transformLinksValue(value);
|
||||
case FieldMetadataType.EMAILS:
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import {
|
||||
type RichTextV2Metadata,
|
||||
richTextV2ValueSchema,
|
||||
type RichTextMetadata,
|
||||
richTextValueSchema,
|
||||
} from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
@@ -29,12 +29,12 @@ const getServerBlockNoteEditor = async (): Promise<ServerBlockNoteEditor> => {
|
||||
return editor;
|
||||
};
|
||||
|
||||
export const transformRichTextV2Value = async (
|
||||
export const transformRichTextValue = async (
|
||||
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
|
||||
richTextValue: any,
|
||||
): Promise<RichTextV2Metadata> => {
|
||||
): Promise<RichTextMetadata> => {
|
||||
const parsedValue = isNonEmptyString(richTextValue)
|
||||
? richTextV2ValueSchema.parse(richTextValue)
|
||||
? richTextValueSchema.parse(richTextValue)
|
||||
: richTextValue;
|
||||
|
||||
const serverBlockNoteEditor = await getServerBlockNoteEditor();
|
||||
Reference in New Issue
Block a user