Skip to content

Fix non-default MR version review in file-by-file mode

Thomas Randolph requested to merge tor/defect/single-file-endpoint-params into master

What does this MR do and why?

For #408712 (closed)

When we get the endpoint for an individual file from the Rails page, it doesn't include any of the page context (like whitespace settings, diff ID, version information, etc.).

So this change extracts what we can from the URL and mixes those into the actual fetch call, to be appended to the "bare" URL.

This enables the MR controls like the version selector and toggling whitespace.

Screenshots or screen recordings

Before After
fbf-versions-before fbf-versions-after

How to set up and validate locally

Please see the reproduction discussion in the associated issue.
Summary:

  1. Create an MR with at least one commit
  2. Amend a commit and push it to create a new version
  3. Repeat above step a couple more times to have multiple versions
  4. With "View files one at a time" (file-by-file) enabled, try to view a version combination that is not base => head (e.g. of 5 versions, view version 2 => version 4)
  5. Note: with fix - the range is respected, without fix - you are always viewing the full changeset between base and head.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Thomas Randolph

Merge request reports