Delete task from work item API
What does this MR do and why?
Related to #346132 (closed)
Specialized mutation to remove a task from a task list in an issue's description. User need to have permission to update the issue and to delete the work item. If user allowed to perform the operation, the mutation should remove the task list item from the description, delete the task from the DB and the associated issue link should also be deleted via cascade.
How to set up and validate locally
- Run
bundle exec rails console
- Run
Feature.enable(:work_items)
- Create a work item (issue) with a task list in the description. Use the convert to work item button next to the checkbox. Inspect the task list to find line start and end in the
data-sourcepos
attribute - Execute a GraphQL query like
mutation {
workItemDeleteTask(
input: {
# id of the issue holding the task list in the description
id: "gid://gitlab/WorkItem/1",
# lock version should be the current lock version of the work item
lockVersion: 2,
# id of the newly created work item
taskData: { id: "gid://gitlab/WorkItem/2", lineNumberStart: 1, lineNumberEnd: 1 }
}
) {
workItem {
id
description
}
}
}
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 #346132 (closed)
Edited by Mario Celi