Ability to mark to-do as "done" in the Design View
Problem to solve
Effective communication in GitLab relies on Todos. If you are mentioned in a comment it's critical to be able to follow the Todo and either take action or mark as done. It's also important to be able to give yourself Todos when you need to remember to work on something or come back later.
Up until now, "marking as done" and "add todo" was not available on Design comments. This really impaired the effectiveness of communication between Designs other workflows.
As of 13.4, Designs achieve parity with Issue comments and their use of Todos for a more consistent and useful experience.
Job story
When going to a design from a to-do, I want to mark it done, so I can mark it complete without having to take action.
@jareko
Proposal from- Duplicate "Mark as done" and "Add a To Do" functionality in the design view
- Clicking "Mark as done" would remove the associated To Do from your To Do's list
- Clicking "Add a To Do" would add a To Do to your To Do's list
- See #198439 (designs) and
- Specs in Sketch Cloud: https://sketch.cloud/s/wM7Qp/a/eY23Vp
Thanks @vkarnes!
cc @cdybenko
frontend work
Exposing a user Todo on a design
The frontend should be able to leverage an existing todo component. For the sake of reusability and abstraction, I believe it should be moved to vue_shared
. This component is 'dumb' and could be easily integrated to work with old Rails API/new GraphQL API.
Adding a ToDo
For MVC 1, adding a ToDo will be implemented the same way we have in Epics
application: with old Rails API. I would recommend wrapping this API call in the local mutation, so
- we could easily update Apollo cache
- we could switch fast from this local mutation to 'real' mutation as soon as we have MVC 2
Done
Marking as We will use an existing GraphQL mutation todoMarkDone
. Why it's preferable over Rails API endpoint here: because we will be fetching a design to-do status as a GraphQL field, and with the mutation, we can easily update an Apollo cache. Also, it won't need any refactoring on MVC 2
backend work
(See #198439 (comment 338539784)):
Adding a Todo, and Marking as Done
- The backend should be able to
Mark as Done
for a Design already as there is an existing GraphQL mutation for this - There will be a small amount of work needed by the backend to support
Add a To Do
for designs by updating the old Rails controllers - we need to add the ability to find the design for the Todo - as we are missing a GraphQL mutation for creating a Todo.
Exposing a user Todo on a design
We'll need a new field
on the Design that will expose a user's Todos. We already have a TodoType
, so we would be exposing something to what is exposed for issuables through a new field
.
I think the trick here would be to introduce Batchloading
for finding these Todos, to avoid the N+1 performance issue that the current User#pending_todo_for
would introduce if we were to use it. This would add a little extra complexity to the task, but would be worth it.
It could be nice to do this field in a way that was reusable for other Todoables in future. Perhaps through a new field type (like markdown_field
), or a new implements
. We could canvass #f_graphql about the best approach to this.