Add pinned file to merge requests
What does this MR do and why?
Implements Linked file feature (previously: Pinned file) (#387246 - closed).
This MR does the following:
- Uses
diff_by_file_hash
endpoint from Add diff_by_file_hash merge request action (!138712 - merged) to fetch pinned file. - Pins a file if we're on a merge request Changes page and there's a
?pin=FILE_HASH
present in the URL- Backend provides an URL to fetch the pinned file by hash using
diff_by_file_hash
endpoint - Frontend fetches that file if the URL is present and pins the file, changing its' order to always be the first in the list of files
- Backend provides an URL to fetch the pinned file by hash using
- Adds a button to unpin the file
Screenshots or screen recordings
Screen_Recording_2023-11-21_at_18.07.48
How to set up and validate locally
- Enable
pinned_file
feature flag - Open any MR with at least two files
- Open a link to a second file a new tab
- File should become pinned
- Unpin the file
- File should appear where it was before pinning
Edited by Stanislav Lashmanov