Skip to content

Commit 22d59fd

Browse files
committed
fix: disallow creating message flow without participants
1 parent 709be3b commit 22d59fd

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/features/rules/BpmnRules.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ BpmnRules.prototype.init = function() {
144144

145145
return every(elements, function(element) {
146146
if (isConnection(element)) {
147-
return canConnect(element.source, element.target, element);
147+
return (canConnect(element.source, element.target, element) || {}).type === element.type;
148148
}
149149

150150
if (element.host) {
@@ -1068,11 +1068,11 @@ function canConnectMessageFlow(source, target) {
10681068
return false;
10691069
}
10701070

1071-
return (
1072-
isMessageFlowSource(source) &&
1073-
isMessageFlowTarget(target) &&
1074-
!isSameOrganization(source, target)
1075-
);
1071+
return isMessageFlowSource(source)
1072+
&& (is(source, 'bpmn:Participant') || !!getParent(source, 'bpmn:Participant'))
1073+
&& isMessageFlowTarget(target)
1074+
&& (is(target, 'bpmn:Participant') || !!getParent(target, 'bpmn:Participant'))
1075+
&& !isSameOrganization(source, target);
10761076
}
10771077

10781078
/**

test/spec/features/rules/BpmnRulesSpec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ describe('features/modeling/rules - BpmnRules', function() {
5858
sequenceFlow = elementFactory.createConnection({
5959
type: 'bpmn:SequenceFlow',
6060
source: task1,
61-
target: task2
61+
target: task2,
62+
waypoints: []
6263
});
6364

6465
// then
@@ -74,7 +75,8 @@ describe('features/modeling/rules - BpmnRules', function() {
7475
sequenceFlow = elementFactory.createConnection({
7576
type: 'bpmn:MessageFlow',
7677
source: task1,
77-
target: task2
78+
target: task2,
79+
waypoints: []
7880
});
7981

8082
// then

0 commit comments

Comments
 (0)