Patch #37636
closedIgnore statuses if workflow only defines identity transition
Description
When editing workflow transitions, we are implicitly storing identity transitions (from a status to the same status, i.e. old_status_id == @new_status_id
). These transition rules are created because the editor renders (disabled) checked checkboxes for those.
These transitions however are not removed when
- checking for statuses used by a workflow (which thus causes any statuses which where previously used in a workflow to always be included in the workflows editor, even when "Only display statuses that are used by this tracker" is checked)
- as well as when getting a list of statuses in use by a tracker in
Tracker#issue_statuses
As the checkboxes for the identity transitions are disabled, those statuses can not be removed by admins.
The attached patch filters the returned statuses by ignoring the identity transitions and only considering transitions for a status to a different status.
Note that for issues, the current status of an issue is generally still allowed. This is ensured by a custom rule for the initial_status
in Issue#new_statuses_allowed_to
. Thus, the identity transitions are not required to be in the database for this to work.
Files