From b290078600ae4e45e7c72bd37919732e3f8fcbea Mon Sep 17 00:00:00 2001 From: ssoorriiin Date: Wed, 25 Sep 2019 01:06:12 +0300 Subject: [PATCH 1/2] fix(modeling): do not remove sequence flow condition on type change * do not remove sequence flow condition when changing type to intermediate catch Closes #1199 --- lib/features/modeling/BpmnUpdater.js | 15 +++++++++++---- .../popup-menu/ReplaceMenuProviderSpec.js | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/features/modeling/BpmnUpdater.js b/lib/features/modeling/BpmnUpdater.js index feb97275..7bda9b53 100644 --- a/lib/features/modeling/BpmnUpdater.js +++ b/lib/features/modeling/BpmnUpdater.js @@ -19,6 +19,10 @@ import { is } from '../../util/ModelUtil'; +import { + isAny +} from './util/ModelingUtil'; + import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; /** @@ -248,10 +252,13 @@ export default function BpmnUpdater( // on reconnectEnd -> conditional flow if (oldTarget && (businessObject.conditionExpression) && - !(is(newTarget, 'bpmn:Activity') || - is(newTarget, 'bpmn:EndEvent') || - is(newTarget, 'bpmn:Gateway') || - is(newTarget, 'bpmn:IntermediateThrowEvent'))) { + !isAny(newTarget, [ + 'bpmn:Activity', + 'bpmn:EndEvent', + 'bpmn:Gateway', + 'bpmn:IntermediateThrowEvent', + 'bpmn:IntermediateCatchEvent' + ])) { context.conditionExpression = businessObject.conditionExpression; businessObject.conditionExpression = undefined; } diff --git a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js index f9461f07..1446351f 100644 --- a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +++ b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js @@ -1817,7 +1817,8 @@ describe('features/popup-menu - replace menu provider', function() { [ 'bpmn:Activity', 'bpmn:EndEvent', - 'bpmn:IntermediateThrowEvent' + 'bpmn:IntermediateThrowEvent', + 'bpmn:IntermediateCatchEvent' ].forEach(function(type) { it('should keep ConditionalFlow when changing target to ' + type, From 37bcd070e8406a43a7316893c6b68debeaae5e26 Mon Sep 17 00:00:00 2001 From: ssoorriiin Date: Tue, 24 Sep 2019 23:10:09 +0300 Subject: [PATCH 2/2] fix(modeling): do not remove default sequence flow on type change * do not remove default sequence flow when changing type to intermediate catch Closes #1197 --- lib/features/modeling/BpmnUpdater.js | 11 +++++++---- .../features/popup-menu/ReplaceMenuProviderSpec.js | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/features/modeling/BpmnUpdater.js b/lib/features/modeling/BpmnUpdater.js index 7bda9b53..171cb022 100644 --- a/lib/features/modeling/BpmnUpdater.js +++ b/lib/features/modeling/BpmnUpdater.js @@ -234,10 +234,13 @@ export default function BpmnUpdater( // on reconnectEnd -> default flow if ((businessObject.sourceRef && businessObject.sourceRef.default) && - !(is(newTarget, 'bpmn:Activity') || - is(newTarget, 'bpmn:EndEvent') || - is(newTarget, 'bpmn:Gateway') || - is(newTarget, 'bpmn:IntermediateThrowEvent'))) { + !isAny(newTarget, [ + 'bpmn:Activity', + 'bpmn:EndEvent', + 'bpmn:Gateway', + 'bpmn:IntermediateThrowEvent', + 'bpmn:IntermediateCatchEvent' + ])) { context.default = businessObject.sourceRef.default; businessObject.sourceRef.default = undefined; } diff --git a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js index 1446351f..527ee3a4 100644 --- a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +++ b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js @@ -1459,7 +1459,8 @@ describe('features/popup-menu - replace menu provider', function() { [ 'bpmn:Activity', 'bpmn:EndEvent', - 'bpmn:IntermediateThrowEvent' + 'bpmn:IntermediateThrowEvent', + 'bpmn:IntermediateCatchEvent' ].forEach(function(type) { it('should keep DefaultFlow when changing target to ' + type,