stable

Clone or download

Read-only

Be able to remove reverse link artifact

Part of story #24970 [modal] select type for links When an artifact source ID is not provided in the `all_links` key and if this source artfact was already linked with the updated artifact then link is removed. If the source artifact ID is provided in the key then the link between the source aritfact and the updated artifact still exists. How to test: - Make sure to have the feature flag enabled => $ tuleap config-set feature_flag_allow_reverse_links 1 - In our example the artifact we want to update is 200. It is already reversed linked to the artifacts 10 and 12. - PUT artifacts/200 and the following payload ``` { "values": [ { "field_id": 154, "all_links": [ { "id": 10, "type": "fixed_in", "direction": "reverse" }, { "id": 45, "type": "fixed_in", "direction": "reverse" } ] } ], "comment": { "format": "commonmark", "body": "" } } ``` Expected results: - The link between 200 and 12 is REMOVED - The link between 200 and 45 is ADDED - The link between 200 and 10 is KEPT Note: We cannot remove all the reversed links when `all_links` is equal to [], it will be done in a future contribution Change-Id: Icf43eac8f036de3342c963d09ad40b5ac605b0b0

Modified Files

Name
M plugins/tracker/include/REST/Artifact/PUTHandler.php +17 −7 Go to diff View file
M plugins/tracker/include/REST/FaultMapper.php +2 −1 Go to diff View file
M plugins/tracker/include/REST/v1/ArtifactsResource.class.php +20 −4 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/ChangesetValue/ArtifactLink/CollectionOfReverseLinks.php +13 −0 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/ChangesetValue/ArtifactLink/NewArtifactLinkChangesetValue.php +12 −0 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/ChangesetValue/ArtifactLink/StoredReverseLink.php +2 −1 Go to diff View file
M plugins/tracker/include/Tracker/Artifact/Link/ArtifactLinker.php +1 −1 Go to diff View file
A plugins/tracker/include/Tracker/Artifact/Link/ArtifactUpdateHandler.php +192 −0 Go to diff View file
A plugins/tracker/include/Tracker/Artifact/Link/HandleUpdateArtifact.php +61 −0 Go to diff View file
R plugins/tracker/include/Tracker/Artifact/Link/LinkArtifact.php Go to diff View file
M plugins/tracker/tests/rest/Artifacts/LinkedArtifactsTest.php +55 −6 Go to diff View file
M plugins/tracker/tests/unit/REST/Artifact/PUTHandlerTest.php +20 −11 Go to diff View file
A plugins/tracker/tests/unit/REST/FaultMapperTest.php +50 −0 Go to diff View file
R plugins/tracker/tests/unit/Stub/LinkArtifactStub.php Go to diff View file
A plugins/tracker/tests/unit/Tracker/Artifact/ChangesetValue/ArtifactLink/CollectionOfReverseLinksTest.php +41 −0 Go to diff View file
A plugins/tracker/tests/unit/Tracker/Artifact/Link/ArtifactFromRestUpdaterTest.php +145 −0 Go to diff View file