Skip to content

Exposed issuable on timelog mutations

What does this MR do and why?

Related to !92234 (merged).

This MR exposes the issuable associated with a timelog on the mutations that operate on timelogs (create and delete, ATM).

This is needed in order to take advantage of apollo smart queries on the frontend.

Attention: this MR has been marked as blocked (and closed) because following the suggestion from @engwan down below I found a better way to make the timelogs UI more reactive 🙂

Screenshots or screen recordings

timelogCreate timelogDelete
Schermata_2022-08-08_alle_22.29.33 Schermata_2022-08-08_alle_22.31.23

How to set up and validate locally

  1. Find an issuable on your load GDK to run tests agains
  2. Replace the issuable ID on this example mutation and make sure the right issuable is returned
mutation c {
  timelogCreate(input: {
    issuableId: "gid://gitlab/<issuable id>",
    timeSpent: "2h",
    spentAt: "2022-08-08",
    summary: "Test summary"
  }) {
    errors
    timelog {
      id
      summary
    }
    issuable {
      ... on Issue {
        issueId: id
        title
      }
      ... on MergeRequest {
        mrId: id
        title
      }
      ... on WorkItem {
        wiId: id
        title
      }
    }
  }
}
  1. On the next example mutation, replace the timelog ID with the one retrieved from the previous mutation and make sure the right issuable is returned
mutation d {
  timelogDelete(input: {id: "gid://gitlab/Timelog/<timelog id>"}) {
    errors
    timelog {
      id
      summary
    }
    issuable {
      ... on Issue {
        issueId: id
        title
      }
      ... on MergeRequest {
        mdId: id
        title
      }
      ... on WorkItem {
        wiId: id
        title
      }
    }
  }
}

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