Support quick actions through work item notes
What does this MR do and why?
- Allows applying quick actions in a note for work items.
Some background knowledge for reviewers
When you leave a comment with quick actions e.g., /close
or /approve
, the body text containing these quick actions goes through several services.
-
Note::CreateService
whereNote
models comments/threads/discussions.-
Note::QuickActionsService
: it interprets a raw text containing quick actions and spits out parsed update parameters/assign @foo
=>{ assignee_ids: [1] }
. Internally the service usesQuickActions::InterpretService
.- Noteable update service where
noteable
is the underlying object such asMergeRequest
,Issue
orEpic
.
- Noteable update service where
-
In this MR we want to support a new type of noteable WorkItem
.
How to set up and validate locally
- Prepare a new Work Item of type Task.
Demo
demoNote the id of the task you just created by running (yes WorkItem
is internally using issues
table.)
gdk psql -c 'SELECT id FROM issues ORDER BY id DESC LIMIT 1;'
- Set a new weight for the work item. (
noteableId
is the global id of the task you just created.)
mutation createWorkItemNote {
createNote(
input: {
noteableId: "gid://gitlab/WorkItem/635",
body: "Set weight \n/weight 1",
discussionId: null
}
) {
note {
id
discussion {
id
notes {
nodes {
id
body
}
}
}
}
errors
__typename
}
}
Refresh the browser and check the weight's been updated for the task.
- Now try setting health status (it should fail because Tasks don't support the attribute.)
mutation createWorkItemNote {
createNote(
input: {
noteableId: "gid://gitlab/WorkItem/635",
body: "/health_status on_track",
discussionId: null
}
) {
...
}
}
{
"data": {
"createNote": {
"note": null,
"errors": [
"Commands only Could not apply health_status command.",
"Command names [\"health_status\"]"
],
"__typename": "CreateNotePayload"
}
}
}
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.
Edited by euko