Fix REST/GRAPHQL APIs handling TODOs WorkItem target
What does this MR do and why?
Fixes a bug when a target_type of a TODO is WorkItem
instead of Issue. This affected both APIs
How to set up and validate locally
- Create a TODO for the logged in user by mentioning the user in an Issue note, leave it as pending
- In the console find that todo and change the target_type to
WorkItem
(todo.update!(target_type: 'WorkItem')
) - curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/todos"
- You should get an error before this change (
uninitialized constant API::Entities::WorkItem
) - In GraphiQL make a query like:
{
currentUser {
todos {
nodes {
id
targetType
}
}
}
}
It should also fail before this change
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #374954 (closed)
Edited by Mario Celi