diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDeactivateWorkflowSingleRecordAction.test.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDeactivateWorkflowSingleRecordAction.test.ts index 77bc31ff8..4faa84f12 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDeactivateWorkflowSingleRecordAction.test.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDeactivateWorkflowSingleRecordAction.test.ts @@ -142,8 +142,9 @@ describe('useDeactivateWorkflowSingleRecordAction', () => { result.current.onClick(); }); - expect(deactivateWorkflowVersionMock).toHaveBeenCalledWith( - activeWorkflowMock.currentVersion.id, - ); + expect(deactivateWorkflowVersionMock).toHaveBeenCalledWith({ + workflowVersionId: activeWorkflowMock.currentVersion.id, + workflowId: activeWorkflowMock.id, + }); }); }); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDiscardDraftWorkflowSingleRecordAction.test.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDiscardDraftWorkflowSingleRecordAction.test.ts index 430954ddd..4157e5f8a 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDiscardDraftWorkflowSingleRecordAction.test.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDiscardDraftWorkflowSingleRecordAction.test.ts @@ -216,7 +216,7 @@ describe('useDiscardDraftWorkflowSingleRecordAction', () => { expect(result.current.shouldBeRegistered).toBe(true); }); - it('should call deactivateWorkflowVersion on click', () => { + it('should call deleteOneWorkflowVersion on click', () => { (useWorkflowWithCurrentVersion as jest.Mock).mockImplementation( () => draftWorkflowMock, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction.ts index 2a51f735b..873993ee4 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction.ts @@ -21,7 +21,10 @@ export const useDeactivateWorkflowSingleRecordAction: ActionHookWithoutObjectMet return; } - deactivateWorkflowVersion(workflowWithCurrentVersion.currentVersion.id); + deactivateWorkflowVersion({ + workflowVersionId: workflowWithCurrentVersion.currentVersion.id, + workflowId: workflowWithCurrentVersion.id, + }); }; return { diff --git a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx index 7c576ce51..0127d7b72 100644 --- a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx +++ b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx @@ -122,9 +122,10 @@ export const RecordShowPageWorkflowHeader = ({ workflowWithCurrentVersion, ); - return deactivateWorkflowVersion( - workflowWithCurrentVersion.currentVersion.id, - ); + return deactivateWorkflowVersion({ + workflowVersionId: workflowWithCurrentVersion.currentVersion.id, + workflowId: workflowWithCurrentVersion.id, + }); }} /> ) : null} diff --git a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx index e0506ef8d..95ef0c28c 100644 --- a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx +++ b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx @@ -130,7 +130,10 @@ export const RecordShowPageWorkflowVersionHeader = ({ Icon={IconPlayerStop} disabled={isWaitingForWorkflowVersion} onClick={() => { - return deactivateWorkflowVersion(workflowVersion.id); + return deactivateWorkflowVersion({ + workflowVersionId: workflowVersion.id, + workflowId: workflowVersion.workflowId, + }); }} /> ) : null} diff --git a/packages/twenty-front/src/modules/workflow/hooks/useActivateWorkflowVersion.ts b/packages/twenty-front/src/modules/workflow/hooks/useActivateWorkflowVersion.ts index efde1e698..70bca3a7c 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useActivateWorkflowVersion.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/useActivateWorkflowVersion.ts @@ -37,7 +37,7 @@ export const useActivateWorkflowVersion = () => { { query: findManyWorkflowVersionsQuery, variables: { - id: workflowId, + workflowId, }, }, ], diff --git a/packages/twenty-front/src/modules/workflow/hooks/useDeactivateWorkflowVersion.ts b/packages/twenty-front/src/modules/workflow/hooks/useDeactivateWorkflowVersion.ts index 4eaddb750..419578849 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useDeactivateWorkflowVersion.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/useDeactivateWorkflowVersion.ts @@ -22,7 +22,13 @@ export const useDeactivateWorkflowVersion = () => { objectNameSingular: CoreObjectNameSingular.WorkflowVersion, }); - const deactivateWorkflowVersion = async (workflowVersionId: string) => { + const deactivateWorkflowVersion = async ({ + workflowVersionId, + workflowId, + }: { + workflowVersionId: string; + workflowId: string; + }) => { await mutate({ variables: { workflowVersionId, @@ -31,7 +37,7 @@ export const useDeactivateWorkflowVersion = () => { { query: findManyWorkflowVersionsQuery, variables: { - id: workflowVersionId, + workflowId, }, }, ],