stable

Clone or download

Read-only

Broken transitions should not be returned by rest route

part of request #25696 Workflow can be broken due to deleted values in transition Rest route returns every transition it found, even when they can not be applied Given a list value have been deleted and given workflow had a transition on it, then the rest route can returns incorrect transitions (from null or to null) Rest route should not provide inconsistent data Note: I don't think I have the best way to reproduce issue: Have a tracker without workflow: - in a tab open the status field and edit it to see its values - in an other tab set a workflow on status, define transitions on the value you want to delete (from and to) - once the workflow is set, remove the value in first tab - go back in workflow and refresh - check the rest routes: when we retrieve the workflow we can see in its representation that there are many transition with `from_id: null` or `to_id:null` This only fix rest api, `TransitionFactory` and `Transition` object still build broken data I'll handle them once by once to limit scope change It seems that there is a missing check on value suppression, the check of value usage seems not be checked by backend before the value removal, I'll handle separatly this issue Change-Id: If12838d89d97b406dc54f6401c9d8b11e7bef3c2

Modified Files

Name
M plugins/timetracking/include/Timetracking/REST/v1/ProjectResource.php +3 −1 Go to diff View file
M plugins/tracker/include/REST/TrackerRestBuilder.class.php +5 −114 Go to diff View file
A plugins/tracker/include/REST/WorkflowRestBuilder.php +120 −0 Go to diff View file
M plugins/tracker/include/REST/v1/ArtifactsResource.class.php +3 −1 Go to diff View file
M plugins/tracker/include/REST/v1/ProjectTrackersResource.class.php +3 −1 Go to diff View file
M plugins/tracker/include/REST/v1/TrackersResource.class.php +3 −1 Go to diff View file
M plugins/tracker/tests/rest/Workflows/SimpleModeTest.php +1 −1 Go to diff View file
M plugins/tracker/tests/rest/Workflows/TrackerWorkflowTransitionsTest.php +4 −4 Go to diff View file
A plugins/tracker/tests/unit/REST/WorkflowRestBuilderTest.php +171 −0 Go to diff View file