Skip to content

FE: Display work item epic in legacy issue's sidebar

When visiting a legacy issue that has a work item epic assigned as a parent, this needs to be displayed in the same way we display the legacy epic, in the issue's right sidebar.

We currently fetch the legacy epic using project_issue_epic.mutation.graphql but if not present we’ll need to check if a work item parent is present instead.

This new query will have to search for a parent using the issue’s id as the work item global ID, for example:

query getParent {
  workItem(id: "gid://gitlab/WorkItem/<LEGACY_ISSUE_ID>") {
    widgets {
      ... on WorkItemWidgetHierarchy {
        parent {
          id
          title
          webUrl
        }
      }
    }
  }
}

For removing the epic we'll also have to use a different query if the epic is a work item, for example:

mutation workItemUpdate { 
  workItemUpdate(input: {id: "gid://gitlab/WorkItem/<LEGACY_ISSUE_ID>", hierarchyWidget: {parentId: null }}) {
    errors
  }
}

Note: To avoid making two requests we can check if the issue has a work item parent. See #423984 (comment 1570054271)

Edited by Eugenia Grieff