Skip to content

Add epic_id param to issue update graphQL mutation

Jarka Košanová requested to merge 230440-graphql-epic-unassign into master

What does this MR do?

Changes in EE::Issues::UpdateService and EE::Issues::CreateService

We already handle epic and epic_id param in the service. We, however, handle each of them differently which does not seem right. When we use epic_id we simply assign an epic to an issue. There is, however, more to it. 2 main things are creating notes and moving the issue to the top in the epic structure. All these things are handled by EpicIssues::CreateService which was always called when epic param is used but not for epic_id.

Additionally, when epic param is set to nil the link between epic and issue is destroyed.

This MR basically changes handling epic_id param and handles it similarly as epic. So an issue is assigned to an epic, moved to the to and notes are created. If epic_id = nil the association is removed. It also uses same methods for create and update

Graphql update issue mutation

The mutation actually already accepts epic_id param without actual execution changes (with limits described above) so here we only add documentation and proper specs.

Examples

Assigning an epic

mutation {
  updateIssue(input: {projectPath: "flightjs/flight", iid: "592", epicId: 56}) {
    issue {
      id
      epic {
        id
        title
      }
    }
    errors
  }
}

Unassigning from an epic

mutation {
  updateIssue(input: {projectPath: "flightjs/flight", iid: "592", epicId: null}) {
    issue {
      id
      epic {
        id
        title
      }
    }
    errors
  }
}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Issue #230440 (closed)

Edited by Jarka Košanová

Merge request reports