From e7316c588ff7bf60965d1dd0502858492df11fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 14 Nov 2022 15:38:19 +0100 Subject: [PATCH] refactor(core): Enable interim updates check (#4582) * :zap: Enable interim updates check * :zap: Set default value * :rewind: Undo default value, keep as sentinel * :test_tube: Unskip tests --- packages/cli/src/workflows/workflows.services.ts | 14 +++++++------- .../integration/workflows.controller.ee.test.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/workflows/workflows.services.ts b/packages/cli/src/workflows/workflows.services.ts index 98de76c726..c940fa1f92 100644 --- a/packages/cli/src/workflows/workflows.services.ts +++ b/packages/cli/src/workflows/workflows.services.ts @@ -196,13 +196,13 @@ export class WorkflowsService { ); } - // if (!forceSave && workflow.hash !== shared.workflow.hash) { - // throw new ResponseHelper.ResponseError( - // `Workflow ID ${workflowId} cannot be saved because it was changed by another user.`, - // undefined, - // 400, - // ); - // } + if (!forceSave && workflow.hash !== '' && workflow.hash !== shared.workflow.hash) { + throw new ResponseHelper.ResponseError( + `Workflow ID ${workflowId} cannot be saved because it was changed by another user.`, + undefined, + 400, + ); + } // check credentials for old format await WorkflowHelpers.replaceInvalidCredentials(workflow); diff --git a/packages/cli/test/integration/workflows.controller.ee.test.ts b/packages/cli/test/integration/workflows.controller.ee.test.ts index 5a24349eb1..0a3c1f4390 100644 --- a/packages/cli/test/integration/workflows.controller.ee.test.ts +++ b/packages/cli/test/integration/workflows.controller.ee.test.ts @@ -730,7 +730,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () => }); }); -describe.skip('PATCH /workflows/:id - validate interim updates', () => { +describe('PATCH /workflows/:id - validate interim updates', () => { it('should block owner updating workflow nodes on interim update by member', async () => { const owner = await testDb.createUser({ globalRole: globalOwnerRole }); const member = await testDb.createUser({ globalRole: globalMemberRole });