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
- Resolves (together with the frontend MR): #627734 (closed)
- Frontend guideline this follows: https://docs.gitlab.com/development/urls_in_gitlab/ (generate URLs in Rails, pass to frontend)
- Same class of bug previously fixed in !245993 (merged)
Screenshots or screen recordings
Not applicable — GraphQL API change only, no UI change in this MR.
How to set up and validate locally
-
Open GraphiQL at
http://gdk.test:3000/-/graphql-explorer -
Run:
{ project(fullPath: "flightjs/Flight") { repository { blobs(ref: "master", paths: ["README.md"]) { nodes { blame(fromLine: 1, toLine: 5) { groups { previousPath commitData { previousBlamePath } } } } } } } } -
previousBlamePathshould be/<group>/<project>/-/blob/<parent-sha>/<path>?blame=1, andnullfor groups whose commit has no parent. -
With
relative_url_root: /gitlabset ingdk.yml, the path should include the/gitlabprefix.
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.