Remove old body on note and tasks (#13290)

Fixes: https://github.com/twentyhq/twenty/issues/13110

I'm deprecating note.body and task.body to remove confusion between body
and bodyV2

What will be left but should be done later to avoid breaking changes:
- re-add a body field in the graphql API only that points to the same
bodyV2 field in SQL (need to be handled in fields and filter for note
and task)
- (wait some time)
- remove bodyV2 field
This commit is contained in:
Charles Bochet
2025-07-19 11:25:49 +02:00
committed by GitHub
parent 62202af1a9
commit fdc6705a75
23 changed files with 124 additions and 128 deletions

View File

@ -13,7 +13,7 @@ export const createOneActivityOperationSignatureFactory: RecordGqlOperationSigna
createdAt: true,
updatedAt: true,
attachments: true,
body: true,
bodyV2: true,
title: true,
},
}
@ -32,7 +32,7 @@ export const createOneActivityOperationSignatureFactory: RecordGqlOperationSigna
__typename: true,
},
attachments: true,
body: true,
bodyV2: true,
title: true,
status: true,
dueAt: true,

View File

@ -3,6 +3,7 @@ import { ReactNode } from 'react';
import { RecoilRoot } from 'recoil';
import { useActivities } from '@/activities/hooks/useActivities';
import { Task } from '@/activities/types/Task';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
jest.mock('@/activities/hooks/useActivityTargetsForTargetableObjects', () => ({
@ -24,17 +25,20 @@ const mockActivityTarget = {
const mockActivity = {
__typename: 'Task',
companyId: '123',
updatedAt: '2021-08-03T19:20:06.000Z',
createdAt: '2021-08-03T19:20:06.000Z',
status: 'DONE',
reminderAt: '2021-08-03T19:20:06.000Z',
title: 'title',
body: 'body',
dueAt: '2021-08-03T19:20:06.000Z',
assigneeId: '1',
id: '234',
};
bodyV2: {
blocknote: 'My Body',
markdown: 'My Body',
},
assignee: null,
taskTargets: [],
} satisfies Task;
const Wrapper = ({ children }: { children: ReactNode }) => (
<RecoilRoot>{children}</RecoilRoot>

View File

@ -39,7 +39,10 @@ const taskTarget = {
createdAt: '2023-04-26T10:12:42.33625+00:00',
updatedAt: '2023-04-26T10:23:42.33625+00:00',
dueAt: null,
body: '{}',
bodyV2: {
blocknote: '',
markdown: '',
},
title: 'Task title',
assigneeId: null,
__typename: 'Task',
@ -95,7 +98,6 @@ const task = {
createdAt: '2023-04-26T10:12:42.33625+00:00',
updatedAt: '2023-04-26T10:23:42.33625+00:00',
title: 'Task title',
body: '',
bodyV2: {
blocknote: null,
markdown: null,

View File

@ -13,7 +13,7 @@ const toISOStringMock = jest.fn(() => mockedDate);
global.Date.prototype.toISOString = toISOStringMock;
const mockedActivity = {
...pick(mockedTasks[0], ['id', 'title', 'body', 'type', 'status', 'dueAt']),
...pick(mockedTasks[0], ['id', 'title', 'bodyV2', 'type', 'status', 'dueAt']),
updatedAt: mockedDate,
};
@ -56,7 +56,10 @@ const mocks: MockedResponse[] = [
}
}
}
body
bodyV2 {
blocknote
markdown
}
createdAt
dueAt
id

View File

@ -17,7 +17,7 @@ const toISOStringMock = jest.fn(() => mockedDate);
global.Date.prototype.toISOString = toISOStringMock;
const mockedActivity = {
...pick(mockedTasks[0], ['id', 'title', 'body', 'type', 'status', 'dueAt']),
...pick(mockedTasks[0], ['id', 'title', 'bodyV2', 'type', 'status', 'dueAt']),
updatedAt: mockedDate,
};

View File

@ -74,7 +74,6 @@ const mocks: MockedResponse[] = [
}
}
}
body
bodyV2 {
blocknote
markdown
@ -181,7 +180,6 @@ const mocks: MockedResponse[] = [
assignee: null,
assigneeId: '123',
attachments: { edges: [] },
body: 'Test',
bodyV2: {
blocknote: 'Test',
markdown: 'Test',

View File

@ -197,7 +197,6 @@ const UPDATE_ONE_FAVORITE_MUTATION = gql`
id
note {
__typename
body
bodyV2 {
blocknote
markdown
@ -393,7 +392,6 @@ const UPDATE_ONE_FAVORITE_MUTATION = gql`
task {
__typename
assigneeId
body
bodyV2 {
blocknote
markdown
@ -592,7 +590,6 @@ export const mocks = [
id
note {
__typename
body
bodyV2 {
blocknote
markdown
@ -788,7 +785,6 @@ export const mocks = [
task {
__typename
assigneeId
body
bodyV2 {
blocknote
markdown

View File

@ -128,7 +128,6 @@ const mocks: MockedResponse[] = [
id
note {
__typename
body
bodyV2 {
blocknote
markdown
@ -571,7 +570,6 @@ const mocks: MockedResponse[] = [
task {
__typename
assigneeId
body
bodyV2 {
blocknote
markdown

View File

@ -7197,27 +7197,6 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
"description": "Task title",
"icon": "IconNotes"
},
{
"__typename": "Field",
"id": "7fd11cd9-16c5-4b29-aa2d-8b4796fc07dd",
"type": "RICH_TEXT",
"name": "body",
"isCustom": false,
"isActive": true,
"isSystem": false,
"isNullable": true,
"isUnique": false,
"createdAt": "2025-06-09T18:53:47.000Z",
"updatedAt": "2025-06-09T18:53:47.000Z",
"defaultValue": null,
"options": null,
"settings": null,
"isLabelSyncedWithName": false,
"relation": null,
"label": "Body (deprecated)",
"description": "Task body",
"icon": "IconFilePencil"
},
{
"__typename": "Field",
"id": "9b83c867-18c1-4c25-bd45-2d3a38ebdbb3",
@ -13000,27 +12979,6 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
"description": "Note title",
"icon": "IconNotes"
},
{
"__typename": "Field",
"id": "21285048-5fd7-4d15-bf60-aec6762cf591",
"type": "RICH_TEXT",
"name": "body",
"isCustom": false,
"isActive": true,
"isSystem": false,
"isNullable": true,
"isUnique": false,
"createdAt": "2025-06-09T18:53:47.000Z",
"updatedAt": "2025-06-09T18:53:47.000Z",
"defaultValue": null,
"options": null,
"settings": null,
"isLabelSyncedWithName": false,
"relation": null,
"label": "Body (deprecated)",
"description": "Note body",
"icon": "IconFilePencil"
},
{
"__typename": "Field",
"id": "b44eecda-a7e8-44ff-8db1-4ce2ca80f34c",

View File

@ -2832,7 +2832,6 @@ export const oneSucceededWorkflowRunQueryResult = {
},
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
body: null,
title: 'Proposal for ',
bodyV2: {
markdown: '',
@ -2968,13 +2967,6 @@ export const oneSucceededWorkflowRunQueryResult = {
value: '123e4567-e89b-12d3-a456-426614174000',
isLeaf: true,
},
body: {
icon: 'IconFilePencil',
type: 'RICH_TEXT',
label: 'Body (deprecated)',
value: 'My rich text',
isLeaf: true,
},
title: {
icon: 'IconNotes',
type: 'TEXT',
@ -4436,7 +4428,6 @@ export const oneSucceededWorkflowRunQueryResult = {
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
result: {
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
body: null,
title: 'Proposal for ',
bodyV2: {
markdown: '',
@ -4573,13 +4564,6 @@ export const oneSucceededWorkflowRunQueryResult = {
value: '123e4567-e89b-12d3-a456-426614174000',
isLeaf: true,
},
body: {
icon: 'IconFilePencil',
type: 'RICH_TEXT',
label: 'Body (deprecated)',
value: 'My rich text',
isLeaf: true,
},
title: {
icon: 'IconNotes',
type: 'TEXT',
@ -8889,7 +8873,6 @@ export const oneSucceededWorkflowRunQueryResult = {
'753b124e-f427-44a4-ab08-bacfe9c2f746': {
result: {
id: '0455ca41-bae1-4a3a-968c-b268a4e809bb',
body: null,
title: 'Proposal for ',
bodyV2: {
markdown: '',
@ -9056,13 +9039,6 @@ export const oneSucceededWorkflowRunQueryResult = {
value: '123e4567-e89b-12d3-a456-426614174000',
isLeaf: true,
},
body: {
icon: 'IconFilePencil',
type: 'RICH_TEXT',
label: 'Body (deprecated)',
value: 'My rich text',
isLeaf: true,
},
title: {
icon: 'IconNotes',
type: 'TEXT',