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
@@ -7,7 +7,7 @@ const compositeFieldTypes = [
|
||||
FieldMetadataType.LINKS,
|
||||
FieldMetadataType.EMAILS,
|
||||
FieldMetadataType.PHONES,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
FieldMetadataType.ACTOR,
|
||||
] as const;
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ describe('computeCompositeColumnName', () => {
|
||||
it('should compute composite column name for rich text v2 field', () => {
|
||||
const fieldMetadata = {
|
||||
name: 'bodyV2',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
};
|
||||
|
||||
const property = {
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ export const isCompositeFieldMetadataType = (
|
||||
| FieldMetadataType.ACTOR
|
||||
| FieldMetadataType.EMAILS
|
||||
| FieldMetadataType.PHONES
|
||||
| FieldMetadataType.RICH_TEXT_V2 => {
|
||||
| FieldMetadataType.RICH_TEXT => {
|
||||
return [
|
||||
FieldMetadataType.CURRENCY,
|
||||
FieldMetadataType.FULL_NAME,
|
||||
@@ -18,6 +18,6 @@ export const isCompositeFieldMetadataType = (
|
||||
FieldMetadataType.ACTOR,
|
||||
FieldMetadataType.EMAILS,
|
||||
FieldMetadataType.PHONES,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
].includes(type);
|
||||
};
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ export const NOTE_FLAT_FIELDS_MOCK = {
|
||||
bodyV2: getFlatFieldMetadataMock({
|
||||
id: 'acb2973c-7e46-4296-ac79-8b8d163b6d85',
|
||||
objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
name: 'bodyV2',
|
||||
label: 'Body',
|
||||
defaultValue: null,
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ export const TASK_FLAT_FIELDS_MOCK = {
|
||||
bodyV2: getFlatFieldMetadataMock({
|
||||
id: '161570ed-7fcd-4172-a5d1-c773cd9afe76',
|
||||
objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
name: 'bodyV2',
|
||||
label: 'Body',
|
||||
defaultValue: null,
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ export class FlatFieldMetadataTypeValidatorService {
|
||||
PHONES: DEFAULT_NO_VALIDATION,
|
||||
POSITION: validatePositionFlatFieldMetadata,
|
||||
RAW_JSON: DEFAULT_NO_VALIDATION,
|
||||
RICH_TEXT_V2: DEFAULT_NO_VALIDATION,
|
||||
RICH_TEXT: DEFAULT_NO_VALIDATION,
|
||||
TEXT: DEFAULT_NO_VALIDATION,
|
||||
TS_VECTOR: validateTsVectorFlatFieldMetadata,
|
||||
UUID: DEFAULT_NO_VALIDATION,
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ const _assertion: Record<string, AbstractFlatFieldMetadata> = {
|
||||
// JSON/Array types
|
||||
rawJson: {} as FlatFieldMetadata<FieldMetadataType.RAW_JSON>,
|
||||
array: {} as FlatFieldMetadata<FieldMetadataType.ARRAY>,
|
||||
richTextV2: {} as FlatFieldMetadata<FieldMetadataType.RICH_TEXT_V2>,
|
||||
richText: {} as FlatFieldMetadata<FieldMetadataType.RICH_TEXT>,
|
||||
|
||||
// Relation types
|
||||
relation: {} as FlatFieldMetadata<FieldMetadataType.RELATION>,
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ export const fromCreateFieldInputToFlatFieldMetadatasToCreate = async ({
|
||||
case FieldMetadataType.POSITION:
|
||||
case FieldMetadataType.ADDRESS:
|
||||
case FieldMetadataType.RAW_JSON:
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
case FieldMetadataType.ACTOR:
|
||||
case FieldMetadataType.ARRAY: {
|
||||
const indexMetadatas: UniversalFlatIndexMetadata[] = [];
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { IsOptional, IsString } from 'class-validator';
|
||||
import { type RichTextV2Metadata } from 'twenty-shared/types';
|
||||
import { type RichTextMetadata } from 'twenty-shared/types';
|
||||
|
||||
@ObjectType('RichTextV2Body')
|
||||
export class RichTextV2BodyDTO implements RichTextV2Metadata {
|
||||
@ObjectType('RichTextBody')
|
||||
export class RichTextBodyDTO implements RichTextMetadata {
|
||||
@Field(() => String, { nullable: true })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
+4
-4
@@ -4,7 +4,7 @@ import { Type } from 'class-transformer';
|
||||
import { IsIn, IsNotEmpty, ValidateNested } from 'class-validator';
|
||||
import { type StandaloneRichTextConfiguration } from 'twenty-shared/types';
|
||||
|
||||
import { RichTextV2BodyDTO } from 'src/engine/metadata-modules/page-layout-widget/dtos/rich-text-v2-body.dto';
|
||||
import { RichTextBodyDTO } from 'src/engine/metadata-modules/page-layout-widget/dtos/rich-text-body.dto';
|
||||
import { WidgetConfigurationType } from 'src/engine/metadata-modules/page-layout-widget/enums/widget-configuration-type.type';
|
||||
|
||||
@ObjectType('StandaloneRichTextConfiguration')
|
||||
@@ -16,9 +16,9 @@ export class StandaloneRichTextConfigurationDTO
|
||||
@IsNotEmpty()
|
||||
configurationType: WidgetConfigurationType.STANDALONE_RICH_TEXT;
|
||||
|
||||
@Field(() => RichTextV2BodyDTO)
|
||||
@Field(() => RichTextBodyDTO)
|
||||
@ValidateNested()
|
||||
@Type(() => RichTextV2BodyDTO)
|
||||
@Type(() => RichTextBodyDTO)
|
||||
@IsNotEmpty()
|
||||
body: RichTextV2BodyDTO;
|
||||
body: RichTextBodyDTO;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import { Injectable } from '@nestjs/common';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { ApplicationService } from 'src/engine/core-modules/application/application.service';
|
||||
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 { WorkspaceManyOrAllFlatEntityMapsCacheService } from 'src/engine/metadata-modules/flat-entity/services/workspace-many-or-all-flat-entity-maps-cache.service';
|
||||
import { findFlatEntityByIdInFlatEntityMapsOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps-or-throw.util';
|
||||
import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util';
|
||||
@@ -115,7 +115,7 @@ export class PageLayoutWidgetService {
|
||||
try {
|
||||
return {
|
||||
...configuration,
|
||||
body: await transformRichTextV2Value(configuration.body),
|
||||
body: await transformRichTextValue(configuration.body),
|
||||
};
|
||||
} catch {
|
||||
return configuration;
|
||||
|
||||
Reference in New Issue
Block a user