-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pasting compensation activity #2220
Conversation
a4bf3f4
to
4bf491a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a while to understand why this fix is working. It turns out it only works because of CompensateBoundaryEventBehavior which adds isForCompensation
when connecting a task to a compensation boundary event and the fact that during paste connections are created after shapes. So with your change in BpmnReplace isForCompensation
is first removed and then added again only if CompensateBoundaryEventBehavior is present. This is not the right fix. Instead, as we discussed, we want to check after replace whether we need to remove isForCompensation
. Try removing the change in BpmnReplace and instead check in BpmnRules not only whether the element is a compensation activity but also whether it is connected to a compensation boundary event. 😉
4bf491a
to
8511c2a
Compare
9cb1bbd
to
e6c8ff5
Compare
6133944
to
9069333
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not break it, and the implementation looks solid / simple enough. Good job.
|
||
function isForCompensation(element) { | ||
const bo = getBusinessObject(element); | ||
return bo && typeof bo.get === 'function' && bo.get('isForCompensation'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what we want to guard with `bo.get === 'function'.
If there is anything specific, let's create a test case. Otherwise, let's assume that the BO is always a moddle element (flowElement) and has a .get
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was caused by some label elements that were breaking this function. I have updated the PR so that now only Task elements are checked for the compensation property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cf. 61d9c02. The test case was broken. For bpmn-js, a business object must always exist.
Also, you don't have to rely on get
, but check the property directly. This is what I changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clarify #2220 (comment) before we can get this merged.
lib/features/modeling/behavior/SetCompensationActivityAfterPasteBehavior.js
Outdated
Show resolved
Hide resolved
4009909
to
702904e
Compare
702904e
to
61d9c02
Compare
Squashed into single semantic commit, will go ahead and update CHANGELOG. |
61d9c02
to
523cfb7
Compare
Waiting for CI to pass so we can merge this. |
Issue:
When copying and pasting a compensation activity the isForCompensation marker isn't being removed on paste. Since that marker is being added and removed automatically the expectation would be that it's removed on paste and only added once the activity is connected to a compensation boundary event.
Fix:
The compensation activity can only exist when connected with compensation boundary activity. When compensation activity is being pasted, it results in simple activity.
Closes #2070