Skip to content

Add `permalinkPath` field to TreeType via TreePresenter

What does this MR do and why?

Related to: Provide `permalink_path` like functionality for... (#524081 - closed)

This merge request adds a permalinkPath field to the GraphQL TreeType, allowing the frontend to generate permalinks to specific commit versions of directories — just like the one we already have on each blob page.

It also introduces a TreePresenter to centralise decoration logic for trees, blobs, and submodules.

Screenshots or screen recordings

Before After
Screenshot_2025-04-03_at_11.12.53_pm Screenshot_2025-04-03_at_3.44.01_pm

How to set up and validate locally

Run this query in your local host(http://127.0.0.1:3000/-/graphql-explorer)

query {
  project(fullPath: "your-repository-path") {
    repository {
      paginatedTree(path: "the-dir-you-want-to-test", ref: "main") {
        nodes {
          __typename
          permalinkPath
          trees {
            nodes {
              name
            }
          }
        }
      }
    }
  }
}

Merge request reports

Loading