GraphQL - issueMoveList mutation repositions issues incorrectly
Summary
The GraphQL mutation that repositions an issue within a board list returns an incorrect position if only one of the params moveBeforeId
and moveAfterId
are present.
Given the following Board with the following mutation, we see the following results by changing moveBeforeId
and moveAfterId
params:
mutation{
issueMoveList(input: {projectPath: "test-group-1/test-project-1", iid: "3", boardId: "gid://gitlab/Board/15", fromListId: 34, toListId: 36, moveAfterId: 475, moveBeforeId: 476}) {
issue {
iid,
relativePosition
}
}
}
Move C before A
|
Move C between A and B | Move C after B |
---|---|---|
In this specific case, Issue C
always end up in the middle position given that the total number of issues in that list is 3, but the behaviour is equivalent to performing the mutation with the params moveAfterId
and moveBeforeId
interchanged.
Steps to reproduce
- Create a project board with at least 2 lists with issues
- With the
full_project_path
, theboard_global_id
of the board and theissue_iid
of one of the issues to move, execute the mutation in GraphQL Explorer by usingother_issue_id
inmoveAfterId
ormoveBeforeId
to change the position of the issue in relation with the other issue:
mutation{
issueMoveList(input: {projectPath: full_project_path, iid: issue_iid, boardId: board_global_id, moveAfterId: other_issue_id, moveBeforeId: number}) {
issue {
iid,
relativePosition
}
}
}
- Reload the board to check the issue's position
What is the current bug behaviour?
In the mentioned migration, the param moveAfterId
acts like moveBeforeId
and vice versa.
What is the expected correct behaviour?
The expected behaviour is to be able to move an issue to a different position with only one of the move params present.
For example, if we interchange moveAfterId
and moveBeforeId
, we observe the correct behaviour
Move C before A
|
Move C between A and B | Move C after B |
---|---|---|
Output of checks
This bug happens on GitLab.com
Possible fixes
When observing the current behaviour for repositioning an issue within a board list, the params seem to be interchanged:
This could be the bug in itself, otherwise, we could modify the mutation IssueMoveList
to switch move_before_id
with move_after_id
when setting the params that are going to be passed to Boards::Issues::MoveService
.