[go: up one dir, main page]

Fix case where line expansion for linked files wants to expand down, but the target line is above the match line

What does this MR do and why?

For #519154 (closed)

There is a very specific error in this scenario:

  • An MR with a single file
  • Using the Linked File feature
  • Linking to a specific line code

In this scenario, the logic for expanding lines eventually resolves to "expand down."
In this specific scenario, however, the correct choice should always be to expand UP.

This is a fix for this scenario (only).

References

Screenshots or screen recordings

Before After
image image

How to set up and validate locally

  1. Create an MR that modifies a single file
  2. Leave a comment on the Diff file
  3. Get the file hash for the file by copying the link to the file from the Changes tab and extracting the file parameter
  4. Click the filename in the Diff file header above your comment on the Overview tab and add the file hash to the URL before any # fragments like: ?file=[hash]#...

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.

Caveats

  • The isExpandDown Linked File computation seems off - a follow-up can simplify the maintainability and readability of this area of the code - perhaps even combining the old logic with the new block. For now, we're just resolving the actual broken UX.
Edited by Thomas Randolph

Merge request reports

Loading