Skip to content

GraphQL: Expose current user todos for todoables

Luke Duncalfe requested to merge 198439-expose-pending-todo-in-graphql into master

What does this MR do?

This MR introduces a new CurrentUserTodos GraphQL interface that can be added to "todoables" to expose todos for the current_user on the object.

The field will return all todos, but accepts an optional state argument of an existing TodoStateEnum value (pending or done).

The specific use-case is #198439 (closed) where we want to discover a user's todo on a Design when querying for it, allowing the user to mark the todo as done using the existing todoMarkDone mutation.

The interface has been added to DesignType, IssueType, MergeRequestType and EpicType.

It hasn't been added to CommitType as the lookup for a todo on a Commit differs from the other "todoables". This could be implemented separately when required.

Example

{
  project(fullPath: <full-path>) {
    issue(iid: <iid>) {
      currentUserTodos(state: pending) {
        nodes {
          id
        }
      }
    }
  }
}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Luke Duncalfe

Merge request reports