Loading
Fix commit list browse files button to link to repository tree
What does this MR do and why?
The folder-open button in the refactored commit list (project_commits_refactor feature flag) was using commit.webUrl, which resolves to the commit detail page — the same destination as clicking the commit title. The previous implementation used project_tree_path(project, commit), which opens the repository file browser at that specific commit SHA.
This fix restores the correct behaviour by injecting projectRootPath (already provided by the app) into both the desktop action buttons and the mobile overflow menu components, and computing the tree path using joinPaths.
References
- Commit list refactor: gitlab-org#17482
Screenshots or screen recordings
| Before | After |
|---|---|
folder-open links to commit detail page (same as title) |
folder-open links to repository tree at commit SHA |
How to set up and validate locally
- Enable the feature flag:
Feature.enable(:project_commits_refactor) - Visit any project's commit list, e.g.
http://gdk.test:3000/gitlab-org/gitlab/-/commits/master - Hover over the
folder-openbutton on any commit row — confirm the URL shown is/-/tree/<sha>(not/-/commit/<sha>) - Click the button — confirm it opens the repository file browser at that commit SHA
- On a narrow viewport, open the
⋮overflow menu and verify "Browse files at this commit" also links to the tree
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