Skip to content

Added service and GraphQL mutation to create timelogs

What does this MR do and why?

This MR lays down some foundations for the work needed for #363880 (closed).

Specifically, this MR adds a service and a GraphQL mutation to create timelogs as the only way to create one was with quick actions and those didn't implement the service.

Screenshots or screen recordings

Schermata_2022-07-10_alle_16.16.14

How to set up and validate locally

  1. Log in into GDK
  2. Find an issue or MR of a project the user you logged in with has at least reporter access and get it's ID
  3. Open a new tab for the GraphiQL explorer
  4. Run this mutation
    mutation {
      timelogCreate(input: {
        issuableId: "<id of the issue or the MR>",
        timeSpent: "1h 5m",
        spentAt: "2022-07-07",
        summary: "Test from GQL"
      })
      {
        errors
        timelog {
          id
          timeSpent
          spentAt
        }
      }
    }
  5. The timelog should get created and a system note added to the issue or the MR
  6. Now impersonate a user with guest access, refresh the GraphiQL explorer page and run the mutation again
  7. It should return an unauthorized error and not create the timelog nor the system note

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marco Zille

Merge request reports