Add previousBlamePath to blame CommitData GraphQL type

What does this MR do and why?

Adds a previousBlamePath field to the CommitData GraphQL type (blame data). This MR exposes a Rails-built path (project_blob_path(project, tree_join(parent_id, previous_path), blame: 1)) through Gitlab::BlamePresenter, so the frontend can consume a root-correct URL instead of assembling its own.

A follow-up frontend MR (stacked on this one) switches the inline blame component to consume this field and removes the client-side URL assembly.

References

Screenshots or screen recordings

Not applicable — GraphQL API change only, no UI change in this MR.

How to set up and validate locally

  1. Open GraphiQL at http://gdk.test:3000/-/graphql-explorer

  2. Run:

    {
      project(fullPath: "flightjs/Flight") {
        repository {
          blobs(ref: "master", paths: ["README.md"]) {
            nodes {
              blame(fromLine: 1, toLine: 5) {
                groups {
                  previousPath
                  commitData {
                    previousBlamePath
                  }
                }
              }
            }
          }
        }
      }
    }
  3. previousBlamePath should be /<group>/<project>/-/blob/<parent-sha>/<path>?blame=1, and null for groups whose commit has no parent.

  4. With relative_url_root: /gitlab set in gdk.yml, the path should include the /gitlab prefix.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Chaoyue Zhao

Merge request reports

Loading
Loading