camunda / camunda-modeler

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.
https://camunda.com/products/modeler
MIT License
1.47k stars 471 forks source link

Do not leave orphaned messages when the last referencing element it deleted #4344

Open strangelookingnerd opened 1 month ago

strangelookingnerd commented 1 month ago

Describe the bug

Currently it is possible to create bpmn:message (as well as escalation, errors...) and add them to the respective events. If the user deletes an event, the message still remains part of the bpmn / XML even if there is no reference to it. Since it is not possible to delete message in an easy manner (#4343) this can create lots of orphaned message references.

Steps to reproduce

  1. Create a new message event with name MyMessage grafik
  2. Delete the message event grafik
  3. Message still remains without reference in the XML grafik

Expected behavior

When deleting a message event the user should be prompted if the referenced message should also be deleted in case it it no longer referenced elsewhere.

Environment

Camunda Modeler system information

Additional context

Related to #4339, #4341, #4343

nikku commented 1 month ago

@strangelookingnerd The way I see it we want to offer users the ability to maintain messages, i.e. through a properties panel entry on the diagram root (process or collaboration): https://github.com/camunda/camunda-modeler/issues/4343, this issue seems to only cure parts of the problem; in fact I think it violates the "no surprises" principle.

To accomplish what you want "no orphaned messages" I suggest a combination of two things: