Skip to content

Add GraphQL mutation to destroy timeline events

What does this MR do and why?

Adds a GraphQL mutation to destroy timeline events.

Contributes to #344061 (closed)

Screenshots or screen recordings

Mutation Result
Screenshot_2022-01-19_at_13.26.11 Screenshot_2022-01-19_at_13.26.41

Mutation

Mutation GraphQL query
mutation DestroyTimelineEvent($input: TimelineEventDestroyInput!) {
  timelineEventDestroy(input: $input) {
    timelineEvent {
      id
      author { id username }
      updatedByUser { id username }
      incident { id title }
      note
      noteHtml
      promotedFromNote { id body }
      editable
      action
      occurredAt
      createdAt
      updatedAt
    }
    errors
  }
}

Query variables:

{
  "input": {
  	"id": "gid://gitlab/IncidentManagement::TimelineEvent/4"
  }
}

How to set up and validate locally

  • Navigate to Monitor > Incidents from the left sidebar menu of your GitLab project
  • Create a new incident
  • Run bundle exec rails c
  • Create a new timeline event: IncidentManagement::TimelineEvent.create!(note: "test", note_html: "test", incident: Issue.last, project: Issue.last.project, action: "comment", occurred_at: Time.current)
  • Grab the last timeline event ID IncidentManagement::TimelineEvent.last.id
  • Open http://localhost:3000/-/graphql-explorer
  • Copy & Paste mutation example
  • Copy & Paste mutation query variables and update timeline event ID with the last timeline ID from the previous steps
  • Run the mutations in GraphiQL
  • Check IncidentManagement::TimelineEvent.find(<ID>) in the rails console

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 Vitali Tatarintev

Merge request reports