Code Search - Git Blame Links
What does this MR do and why?
Closes #327052 (closed)
This change adds an additional link the code blobs of Code Search. This link will link the user to the File Blame rather than the File Diff. Additionally this change bumps the SVG size up and adds a background hover color identical to the MR Diff tab.
Due to the change in implementation here we opted to move this HAML partial into its own Search specific one rather than the shares/file_highlight
. This was to ensure we didn't overreach in our change as the markup is changing quite a bit.
Essentially rather than using a ::before
along with a :hover
we are switching to simply using a :hover
and visibility: visible
effect.
Important: There are some contrast concerns with the icons. This will be addressed in the follow up: #346975 (closed)
Screenshots or screen recordings
Theme | Before | After |
---|---|---|
White | ||
Dark | ||
Solar Light | ||
Solar Dark | ||
Monakai | ||
None |
Tooltip
How to set up and validate locally
Standard Testing
- Fetch and checkout this branch
- Navigate to a project with code
- Using the top right search in the header nav, search for some code (ie
const
) - Hover over a line number on a code blob
- Ensure both the Git Blame icon and the Link icon appear
- Hover over the Git Blame icon and ensure the hover text says "View blame"
- Click the Git Blame icon and ensure it takes you to the blame file for that line
- Go back to the search and click the Link Icon and ensure it takes you to the file for that line
Test edge cases
- Fetch and checkout this branch
- Download this patch file: cuddy-patch.txt
- Copy the file contents to your clipboard
- Navigate to your
/gitlab
directory in your terminal with this branch checked out - Enter the command
pbpaste | git apply
- This will apply local changes that will randomly generate 10^x - 1 for random line numbers
- Ensure the each line holder contains all the lines correctly and doesn't misalign them on desktop or mobile
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #327052 (closed)