Skip to content

Align TodoFinder and GraphQL API

Lukas Eipert requested to merge todo-backend-fixes into master

What does this MR do and why?

Todos: Add namespace and project target types to GraphQL

If you have a member access request for a project, the target type will be a project or a namespace. The GraphQL API didn't know about this, leading to errors.

We also add a spec that makes sure that all known types for the TodoFinder are exposed in the GraphQL enum.

Changelog: fixed

Allow to search for todos with commit target type

Apparently we can have todos on commits. GraphQL knows about it, the backend knows about, but the TodoFinder didn't. So if you searched for todos related to commits, you would get an error.

Changelog: fixed

Todos: Add spec that all actions are mapped in GraphQL

In order to prevent errors in case a new type is introduced

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

N/A

How to set up and validate locally

For the missing "COMMIT" finder (fixed with 276c8643):

  1. Go to any commit and create a comment with an @-mention (you can at-mention the user itself)
  2. Run the following query in the /-/graphql-explorer
COMMIT query
    query todos {
      currentUser {
        id
        todos(type: COMMIT, state: [done,pending]) {
          nodes {
            id
            state
            createdAt
            action
            targetType
            __typename
          }
          __typename
        }
        __typename
      }
    }

For the missing Namespace and Project (fixed with b6c6b4bd)

  1. Make sure you have a public project as User A
  2. Log in as User B and "Request access" to the Project
  3. Run the following query in the /-/graphql-explorer as User A
Project / Namespace query
query todos {
  currentUser {
    id
    todos(action: [member_access_requested], state: [done, pending]) {
      nodes {
        id
        state
        createdAt
        action
        targetType
        __typename
      }
      __typename
    }
    __typename
  }
}
Edited by Lukas Eipert

Merge request reports

Loading