Sync epic child reordering via REST api
What does this MR do and why?
Related to #455635 (closed)
When reordering child epics using EpicLinks::UpdateService
the associated work items should be synced to the same relative position.
The conditions for the syncing are:
- the feature flag
sync_epic_to_work_item
is enabled - The parent and child epic have synced work items that are as related (with a
WorkItems::ParentLink
record) - When
move_after_id
ormove_before_id
epics are provided, these also have a synced work item with the corresponding link to the parent
MR acceptance checklist
Screenshots or screen recordings
The changes in this MR are tested using the REST endpoint for reordering a child epic: PUT /groups/:id/epics/:epic_iid/epics/:child_epic_id
. We cannot use the UI to replicate the changes because this uses a different endpoint.
Screen_Recording_2024-04-17_at_18.43.02
How to set up and validate locally
- Enable feature flags
sync_epic_to_work_item
andsync_epic_work_item_order
- Create one epic Parent using the URL
http://gdk.test:3000/groups/GROUP_PATH/-/epics/new
- Create 3 more epics Child 1, Child 2 and Child 3 using the same URL from above
- Go to epic Parent by visiting
http://gdk.test:3000/groups/GROUP_PATH/-/epics/PARENT_IID
and add 3 new epics as children: Child 3, Child 2 and Child 1 - Verify that the corresponding work item have also 3 children in the same order (use URL
http://gdk.test:3000/groups/GROUP_PATH/-/work_items/EPIC_A_IID
) - Create an access token with API access and test the following request
export PAT=<access_token>
curl -X PUT -H "Authorization: Bearer $PAT" -d move_before_id=CHILD_2_ID -d move_after_id=CHILD_3_ID http://127.0.0.1:3000/api/v4/groups/GROUP_PATH/epics/PARENT_IID/epics/CHILD_1_ID
- Reload the
PARENT
epic and work item and verify that Child 2 was moved before and Child 3 was moved after the Child 1
Before reordering | After reordering |
---|---|
Child 1 | Child 2 |
Child 2 | Child 1 |
Child 3 | Child 3 |
Edited by Eugenia Grieff